009-002-003
Public Modifier: Access Control Demo
Easy
Problem Description
Public Modifier: Access Control Demo
Learning Objective: Understand external access through public modifier
Create a BankAccount class and use public modifier to make fields and methods accessible from outside.
Input
Line 1: Account name (string)
Line 2: Initial balance (integer)
Output
Account: [account name]
Balance: [balance] yen
Test Cases
※ Output examples follow programming industry standards
Input:
Savings 10000
Expected Output:
Account: Savings Balance: 10000 ¥
Input:
Checking 5000
Expected Output:
Account: Checking Balance: 5000 ¥
Input:
New Account 0
Expected Output:
Account: New Account Balance: 0 ¥
❌ Some tests failed
Your Solution
Current Mode:● My Code
99
1
2
3
4
5
6
7
8
9
10
›
⌄
⌄
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Write your code here
sc.close();
}
}
0 B / 5 MB
You have 9 free executions remaining
