015-002-001

Employee Upcast

Easy

Problem Description

Create Employee and Manager classes where Manager extends Employee. Demonstrate upcasting by assigning a Manager object to an Employee type variable and accessing parent class methods.

Test Cases

※ Output examples follow programming industry standards

Input:
new Manager("Alice", 500000)
Expected Output:
Employee Info:
Name: Alice
Salary: 500000¥
Role: Manager
Input:
new Manager("Bob", 600000)
Expected Output:
Employee Info:
Name: Alice
Salary: 500000¥
Role: Manager
Input:
new Manager("C", 1)
Expected Output:
Employee Info:
Name: Alice
Salary: 500000¥
Role: Manager
❌ Some tests failed
❌ エラー発生

Your Solution

Current Mode: My Code
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