Question
Deliverables: person.java student.java professor.java TA.java app.java Contents Using inheritance and the class Person (below) Create an application that: Creates 1 student, 1 professor, 1 TA.
Deliverables:
person.java
student.java
professor.java
TA.java
app.java
Contents
Using inheritance and the class Person (below)
Create an application that:
Creates 1 student, 1 professor, 1 TA.
student is a person with a status ("traditional" or "non-traditional") and a major
professor (a person with a degree attribute, a string with "Ph.D" or "MsC.")
TA (a person with communications skills attribute, an int value from 1 to 10)
Displays all information about each instance
Does it in the most efficient way possible (avoids unnecessary duplication)
Uses the classes
person and student available on Canvas below
student already inheriting from person in the example below
Adding a major to the student class
Creating a display method in student to solve the lab
Note:
The way it is now, it does not display major or status.
The correct solution has to display major and status.
You have to create professor and TA from scratch.
**No changes needed in the code of person.java**
Example: class app { public static void main(String[] args) { student st1 = new student("Zack","Mills",21); System.out.println(st1.getInfo()); } } //============================== class person { String firstName; String lastName; int age; person(String informedFirstName, String informedLastName, int informedAge) { firstName = informedFirstName; lastName = informedLastName; age = informedAge; } String whatIsUp() { return "undetermined"; } String getName() { return firstName +" "+lastName; } String getAge() { String str = String.valueOf(age); return str; } String getInfo() { return ("Name = "+ getName() + " age="+ getAge()); } } //========================================= class student extends person { String status; student(String informedFirstName, String informedLastName, int informedAge) { super(informedFirstName, informedLastName, informedAge); if (age <= 25) status = "Traditional"; else status = "Non-Traditional"; } String whatIsUp() { int n = 0; String b = "..."; n = (int) (Math.random()*2); if (n == 0) b = "reading"; if (n == 1) b = "talking"; return b; } String getStatus() { return status; } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started