Question: In Java** Using extends keyword The class diagram with four classes Student, Graduate and Undergraduate is given. The Write down the classes as described in

In Java** Using extends keyword

The class diagram with four classes Student, Graduate and Undergraduate is given. The Write down the classes as described in the class diagram. The fields and methods for each class are given below.

Student

Graduate

Undergraduate

Student:

Fields: major (String)

gpa (double)

creditHours (int)

Methods:

getGpa: returns gpa

getYear: returns freshman, sophomore, junior or senior as determined by earned credit hours:

  • 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

Graduate:

Fields: degree (String) (masters or phd)

concentration (String)

years (int) (stores no. of years spent in grad school)

Methods: getYear: returns years

getConcentration: returns concentration

Undergraduate:

Fields: honors (Boolean)

Methods: isHonors: returns honors

  • Write another client class.
  • Create an object of class Undergraduate called John whose major is CS, gpa is 3.75, credit hours = 40 and honors = false.
  • Create an object of class Graduate called Zooey whose degree is Masters, years = 1, gpa is 4, major =computer science and concentration is Bioinformatics.
  • Print out the Johns major, gpa, year and use isHonors method to see if the student is an honors student.
  • Print out the Zooeys concentration, years spent in grad school and major.

**need to create four java files and use three constructors

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!