Problems
Java Person Teacher 1
Java Person Teacher 1
Implement a class Person.
Implement a class Teacher that extends Person.
class Person
{
protected String Surname, Name;
protected int Age;
Person(String Surname, String Name, int Age) // Constructor
public String toString() // print Surname Name Age
}
class Teacher extends Person
{
protected String Subject;
protected int Salary;
Teacher(String Surname, String Name, int Age, String Subject, int Salary) // Constructor
public String toString() // print Surname Name Age Subject Salary
}
Input
Each line contains one of two types of people in the next format:
- PersonSurname Name Age
- TeacherSurname Name Age Subject Salary
Output
For each person print in one line its data.
Input example #1
Person Ivanov Sergey 28 Teacher Petrov Ivan 34 Physics 400 Teacher Babayev Petr 28 Physics 450 Person Lenov Yuriy 21 Teacher Ermolov Kirill 44 Math 400 Teacher Fedoseev Nikita 38 Math 630 Teacher Egorova Dasha 32 Geography 450
Output example #1
Ivanov Sergey 28 Petrov Ivan 34 Physics 400 Babayev Petr 28 Physics 450 Lenov Yuriy 21 Ermolov Kirill 44 Math 400 Fedoseev Nikita 38 Math 630 Egorova Dasha 32 Geography 450