016-003-002

Employee Inheritance with Manager

Easy

Problem Description

Create an Employee base class with name field and introduce() method. Then create a Manager class that extends Employee and adds a department field, using super() to call the parent constructor.

Test Cases

※ Output examples follow programming industry standards

Input:
new Employee("Tanaka"); emp.introduce()
Expected Output:
=== Employee ===
I am Tanaka
=== Manager ===
I am Suzuki
Department: Sales
Input:
new Manager("Suzuki", "Sales"); mgr.introduce()
Expected Output:
=== Employee ===
I am Tanaka
=== Manager ===
I am Suzuki
Department: Sales
Input:
new Manager("Sato", "Engineering"); mgr.getDepartment()
Expected Output:
=== Employee ===
I am Tanaka
=== Manager ===
I am Suzuki
Department: Sales
❌ 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