Create a object called Teacher. Declare the following variables for the object: string f_name, string subject, int age and int room_no. Include in the object a default constructor and a parameterised constructor. The parameterised constructor has the following parameters (name and age). Create your main class Teaching. The reference variable for the default constructor is T1 and for the parameterised constructor is T2. Pass the following values for the T1 reference to the default constructor: f_name = John subject = Science age = 35 room_no = 10 Pass the following variable using the T2 reference to the parameterised constructor: name = Smith age = 45 Program must include System.out statements to display the output
Create a object called Teacher. Declare the following variables for the object: string f_name, string subject, int age and int room_no. Include in the object a default constructor and a parameterised constructor. The parameterised constructor has the following parameters (name and age). Create your main class Teaching. The reference variable for the default constructor is T1 and for the parameterised constructor is T2. Pass the following values for the T1 reference to the default constructor: f_name = John subject = Science age = 35 room_no = 10 Pass the following variable using the T2 reference to the parameterised constructor: name = Smith age = 45 Program must include System.out statements to display the output
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 8PE
Related questions
Question
Create a object called Teacher. Declare the following variables for the object: string f_name, string subject, int age and int room_no.
Include in the object a default constructor and a parameterised constructor. The parameterised constructor has the following parameters (name and age).
Create your main class Teaching. The reference variable for the default constructor is T1 and for the parameterised constructor is T2.
Pass the following values for the T1 reference to the default constructor:
f_name = John
subject = Science
age = 35
room_no = 10
Pass the following variable using the T2 reference to the parameterised constructor:
name = Smith
age = 45
Program must include System.out statements to display the output.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning