014-004-001

protected Modifier: Account Class

Easy

Problem Description

protected Modifier: Account class

In this problem, you will create a program that accesses protected fields of an Account class directly from a SavingsAccount child class, then calculates and displays account information along with interest.

Learning Objective: Access protected fields directly from child class

Create an Account class representing bank accounts and a SavingsAccount class inheriting from it. Learn that a child class can directly access the parent class's protected fields.

Input

Line 1: Account number (string)
Line 2: Balance (integer)

Output

Account: [account number]
Balance: [balance]yen
Type: Savings
Interest: [balance*0.01]yen

Examples

Example 1: Basic account

Input:

ACC001
10000

Output:

Account: ACC001
Balance: 10000yen
Type: Savings
Interest: 100.0yen

Example 2: Different account

Input:

ACC999
50000

Output:

Account: ACC999
Balance: 50000yen
Type: Savings
Interest: 500.0yen

Example 3: Boundary (minimum balance)

Input:

A
1

Output:

Account: A
Balance: 1yen
Type: Savings
Interest: 0.01yen

Test Cases

※ Output examples follow programming industry standards

Normal case
Input:
SAV123
25000
Expected Output:
Account: SAV123
Balance: 25000yen
Type: Savings
Interest: 250.0yen
Normal case
Input:
CHK456
100000
Expected Output:
Account: CHK456
Balance: 100000yen
Type: Savings
Interest: 1000.0yen

Your Solution

Current Mode: My Code
Account.java🔒
SavingsAccount.java🔒
Solution.java🔒
3/6 ファイル174B
public class Account {
}
0 B / 5 MB

You have 10 free executions remaining