009-002-004
Public Modifier: Bank Account
Medium
Problem Description
Public Modifier: Bank Account
In this problem, you will create a program that directly accesses public fields of a BankAccount class from an external class, and displays the account owner and balance in a specified format to standard output.
Learning Objective
Learn access control with public modifier.
Problem
Create a program that displays account information using public fields and methods of BankAccount class.
Input
Line 1: Account owner (string)
Line 2: Balance (integer)
Output
Owner: [owner]
Balance: [balance]
Test Cases
※ Output examples follow programming industry standards
Input:
Tanaka 50000
Expected Output:
Owner: Tanaka Balance: 50000
Input:
Suzuki 120000
Expected Output:
Owner: Suzuki Balance: 120000
Input:
Yamada 75000
Expected Output:
Owner: Yamada Balance: 75000
Input:
Test 0
Expected Output:
Owner: Test Balance: 0
❌ Some tests failed
Your Solution
Current Mode:● My Code
BankAccount.java🔒
Main.java🔒
2/6 ファイル96B
⚠️警告
- No main method found
9
1
2
3
4
›
⌄
import java.util.Scanner;
class BankAccount {
}
0 B / 5 MB
You have 9 free executions remaining
