Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

java!!! The class diagram with four classes Person, Staff, Student, Exchange Student is given. The Write down the classes as described in the class diagram.

image text in transcribed
image text in transcribed
image text in transcribed
java!!!
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 current Maxld 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) spa (double) credit Hours (int) Methods: Student(firstName, lastName, gpa, year) getGpa: returns spa getYear: returns freshman, sophomore, junior or senior as determined by earned credit hours: setCreditHours(creditHours) setGpagpa) 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 setAdmission Year(year) setCountry country) toString(): String in a format "Exchange Student[Student:[Person:[First name:?, Last name: ?, id:?), year:?, spa:?], country:?, admission year:?)" Write another client class. Create an object of class Staff called Alex whose department is CS, pay is S4000. Print it using toString Method 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management With Website Development Applications

Authors: Greg Riccardi

1st Edition

0201743876, 978-0201743876

More Books

Students also viewed these Databases questions

Question

1. Outline the listening process and styles of listening

Answered: 1 week ago

Question

4. Explain key barriers to competent intercultural communication

Answered: 1 week ago