Please show work and final output display. Thank you. In this assignment, you wi
ID: 3723634 • Letter: P
Question
Please show work and final output display. Thank you.
In this assignment, you will use object-oriented programming techniques to model a basic University system 1. You will need to model the following classes: Address, Person, Student, Staff and Faculty. You may also model other classes as needed. 2. Provide three interfaces: Employee (with a salary0 method), and child interfaces (with Instructor(with a creditsTaught0 method) and Administrator position0 method). You may also provide other interfaces as needed. a 3. You will need to capture the following data members: first name, middle name, last name, date of birth, gender, address first line, city of address, state of address, zipcode of address, current semester enrolled in, number of credits completed, graduation status, PhD status for graduate students, number of credits currently enrolled in, department of employment, major and salary. Decide carefully where each data member (there are 17 data members listed) should be stored. 4. You may provide additional data members as needed. 5. Accessors should be provided for all data members 6. No mutators should be provided for any data member. The only way to modify data members from any class outside this hierarchy is to use the constructors (directly) or the methods below (indirectly). 7. Your implementation should include abstract classes, "concrete" classes, interfaces, inheritance and polymorphismExplanation / Answer
NOTE:- In java all the classes are by default the child classes of "object" class and object class already having a method named "toString()", so we cannot override the method if we do so it is a compile-time error.
so I am taking method name as "toStringDetails()" instead of "toString()".
Answering 8 parts of the question as the question is too long to complete.
CODE
class Address{
private String address;
private String city_of_address;
private String state_of_address;
private String zipcode_of_address;
Address(String address, String city_of_address, String state_of_address, String zipcode_of_address){
this.address=address;
this.city_of_address=city_of_address;
this.state_of_address=state_of_address;
this.zipcode_of_address=zipcode_of_address;
}
public void toStringDetails(){
System.out.println("Address:"+address);
System.out.println("City:"+city_of_address);
System.out.println("State:"+state_of_address);
System.out.println("Zipcode:"+zipcode_of_address);
}
}
class Person{
private String first_name;
private String middle_name;
private String last_name;
private String date_of_birth;
private String gender;
Person(String first_name, String middle_name, String last_name, String date_of_birth, String gender){
this.first_name=first_name;
this.middle_name=middle_name;
this.last_name=last_name;
this.date_of_birth=date_of_birth;
this.gender=gender;
}
public void toStringDetails(){
System.out.println("First name: "+first_name);
System.out.println("Middle name: "+middle_name);
System.out.println("Last name: "+last_name);
System.out.println("Date Of Birth: "+date_of_birth);
System.out.println("Gender: "+gender);
}
}
class Student{
private int current_semester;
private int credits_completed;
private String graduation_status;
private String phd_status;
private int credits_enrolled;
Student(int current_semester, int credits_completed, String graduation_status, String phd_status, int credits_enrolled){
this.current_semester=current_semester;
this.credits_completed=credits_completed;
this.graduation_status=graduation_status;
this.phd_status=phd_status;
this.credits_enrolled=credits_enrolled;
}
public void toStringDetails(){
System.out.println("Current Semester: "+current_semester);
System.out.println("Credits Completed: "+credits_completed);
System.out.println("Graduation Status: "+graduation_status);
System.out.println("PHD Status: "+phd_status);
System.out.println("Credits Enrolled: "+credits_enrolled);
}
public String status(){
if(graduation_status=="undergaduate"){
int total_credit=credits_completed+credits_enrolled;
if(0<total_credit & total_credit<30){
return "freshman";
}
else if(31<total_credit & total_credit<60){
return "sophomore";
}
else if(61<total_credit & total_credit<90){
return "junior";
}
else if(total_credit>90){
return "senior";
}
}
else if(graduation_status=="graduated"){
if(phd_status=="masters" && graduation_status=="graduated"){
return "masters";
}
else if(phd_status=="doctoral" && graduation_status=="graduated"){
return "doctoral";
}
else if(phd_status=="" && graduation_status=="graduated"){
return "graduated";
}
}
else if(graduation_status!="graduated" && graduation_status!="undergaduate"){
return "special";
}
return "Something Went Wrong.";
}
public boolean isFullTime(){
if(graduation_status=="undergaduate"){
if(credits_enrolled>=12){
return true;
}
else{
return false;
}
}
if(graduation_status=="graduated"){
if(phd_status=="masters" && credits_enrolled>=6){
return true;
}
else if(phd_status=="doctoral"){
return true;
}
else{
return false;
}
}
return false;
}
public boolean graduate(){
if(graduation_status=="undergaduate" || phd_status=="doctoral"){
if(credits_completed>=120){
graduation_status="graduated";
credits_enrolled=0;
return true;
}
}
else if(phd_status=="masters"){
if(credits_completed>=30){
graduation_status="graduated";
credits_enrolled=0;
return true;
}
}
return false;
}
}
class Staff{
private String department;
private String major;
private double salary;
Staff(String department, String major, double salary){
this.department=department;
this.major=major;
this.salary=salary;
}
public void toStringDetails(){
System.out.println("Department: "+department);
System.out.println("Major: "+major);
System.out.println("Salary: "+salary);
}
}
class Faculty{
}
interface Employee{
}
interface Instructor extends Employee{
}
interface Administrator extends Employee{
}