Question: This is assignment is meant to be done in Java. Please make it clear and easy to find/distinguish classes in your response. The class diagram
This is assignment is meant to be done in Java. Please make it clear and easy to find/distinguish classes in your response.






The class diagram with four classes Person, Staff, Student, Exchange Student is given. The Write down the classes as described in the class diagram. The fields and methods for each class is given below. Person Staff Student Exchange Student Person: Fields (private): firstName(String) lastName(String) id (int) Methods: Person (firstName, lastName) getName(): String setName(firstName, lastName) getid) toString(): String in a format "Person:[First name:?, Last name: ?, id:?]" The id field should be initialized automatically in the constructor. Use static field currentMaxld to determine next available id. Staff: Fields (private): department(String) pay(double) Methods: Staff(firstName, lastName, department, pay) getDepartment(): String setDepartment department) getPay(): double setPay(pay) toString(): String in a format "Staff:[Person:[First name:?, Last name: ?, id:?), department:?, pay:?)" Student: Fields: major (String) gpa (double) creditHours (int) Methods: Student(firstName, lastName, gpa, year) getGpa: returns gpa getYear: returns freshman, sophomore, junior or senior as determined by earned credit hours: setCreditHours(creditHours) setGpa(gpa) Freshman: Less than 32 credit hours Sophomore: At least 32 credit hours but less than 64 credit hours Junior: At least credit hours SH but less than 96 credit hours Senior: At least 96 credit hours toString(): String in a format "Student:[Person:[First name:?, Last name: ?, id:?), year:?, gpa:?]" Exchange Student: Fields: country (String) admission Year(string) (start date of the exchange program, stores Fall, Spring or Summer followed by the year eg: Fall 2017) Methods: getAdmission Year: returns year getCountry: returns country setAdmissionYear(year) setCountry(country) toString(): String in a format "Exchange Student[Student:[Person:[First name:?, Last name: ?, id:?), year:?, gpa:?], country:?, admission year:?]" Write another client class. Create an object of class Staff called Alex whose department is CS, pay is $4000. Print it using toStringMethod Create an object of class Student called Mary, credit hours = 54, and gpa is 3.90. Print it using toString() method. Create an object of class Exchange Student for an exchange student for Summer 2019 from England and print out it using toString(). Create an array of Person populate it with at least five objects of Staff, Student, Exchange Student type, and print them using for loop and System.out.print() method
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
