015-002-001
Employee Upcast
Easy
Problem Description
In this problem, you will create a program that defines an Employee class and a Manager class extending Employee, reads name and salary from standard input, assigns a Manager object to an Employee type variable to demonstrate upcasting, and displays the result of calling parent class methods to standard output.
Create Employee and Manager classes where Manager extends Employee. Read name (line 1) and salary (line 2) from standard input, then demonstrate upcasting by assigning a Manager object to an Employee type variable and accessing parent class methods.
Input:
- Line 1: name (String)
- Line 2: salary (int)
Output:
Employee Info:
Name: <name>
Salary: <salary>yen
Role: Manager
Test Cases
※ Output examples follow programming industry standards
Normal case
Input:
Alice 500000
Expected Output:
Employee Info: Name: Alice Salary: 500000yen Role: Manager
Normal case
Input:
Bob 600000
Expected Output:
Employee Info: Name: Bob Salary: 600000yen Role: Manager
Your Solution
Current Mode:● My Code
Employee.java🔒
Manager.java🔒
Main.java🔒
3/6 ファイル99B
⚠️警告
- No main method found
9
1
2
›
⌄
class Employee {
}
0 B / 5 MB
You have 10 free executions remaining
