015-003-005

Downcast: Employee Class

Easy

Problem Description

Downcast: Employee class

In this problem, you will create a program that reads a name, salary, and team name from standard input, checks the type of a Manager object stored in an Employee-type variable using instanceof, downcasts it to the Manager class, and displays the employee information to standard output.

Learning Objective: Understand downcast explicitly casting parent class reference to child class type

Create an Employee class representing employees and a Manager class that inherits from it. Store a Manager object in an Employee-type variable, check its type with instanceof, cast it to the child class type (downcast), and call child-class-specific methods.

Input

Line 1: Name (string)
Line 2: Salary (integer)
Line 3: Team name (string)

Output

Employee Info:
Name: [name]
Salary: [salary]yen
Team: [team]
```java

## Examples

### Example 1: Manager Alice
Input:
```java
Alice
500000
Marketing
```java
Output:
```java
Employee Info:
Name: Alice
Salary: 500000yen
Team: Marketing
```java

### Example 2: Manager Bob
Input:
```java
Bob
600000
Sales
```java
Output:
```java
Employee Info:
Name: Bob
Salary: 600000yen
Team: Sales
```java

### Example 3: Boundary (single character values)
Input:
```java
C
1
A
```java
Output:
```java
Employee Info:
Name: C
Salary: 1yen
Team: A

Test Cases

※ Output examples follow programming industry standards

Normal case
Input:
Carol
750000
Engineering
Expected Output:
Employee Info:
Name: Carol
Salary: 750000yen
Team: Engineering
Normal case
Input:
David
450000
Finance
Expected Output:
Employee Info:
Name: David
Salary: 450000yen
Team: Finance

Your Solution

Current Mode: My Code
Employee.java🔒
Manager.java🔒
Main.java🔒
3/6 ファイル165B
public class Employee {
}
0 B / 5 MB

You have 10 free executions remaining