Java program: The class diagram with four classes Mammal, Human, Student and Doctor is given. The Mammal class is given as well. Write down the remaining classes as described in the class diagram. The fields and methods for each class is given in the attachment. //in Mammel.java Public interface Mammal{ public double hairColor(): }   1. Class Human: Fields: age(int), weight(double), height(double) Methods: getAge, getWeight, getHeight 2. Class Student: Fields: major (String), gpa (double), creditHours (int) methods: getMajor: returns major, getGpa: returns gpa, getYear: returns freshman, sophmore, junior, senior as determined by earned credit hours Freshman : less than 32 credit hours sophmore: at least 32 but less than 64 credit hours junior: at least 64 credit hours but less than 96 credit hours senior: at least 96 credit hours 3.Class Doctor: Fields: years(int), Speciality (String) methods: getYears: returns years, getSpeciality: returns speciality, getSalary: calculates salary. base salary is 40,000 for the first year and for each additional year gets 5000 more. so in second year doctor gets 45000 and so on. 4. Write another client class. create an object of class Student Called Alex whose major is CS, GPA is 3.4, credit hours is 54, height is 170 cm, weight is 150 pounds and age is 18. create an object of class Doctor called Jack whose speciality is "Dermatology", years is 4, height is 173 cm, weight is 179 pounds and age is 40. print out the students major, gpa, year, and age print out the doctor's speciality, height, weight, and salary.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Java program:

The class diagram with four classes Mammal, Human, Student and Doctor is given. The Mammal class is given as well. Write down the remaining classes as described in the class diagram. The fields and methods for each class is given in the attachment.
//in Mammel.java
Public interface Mammal{
public double hairColor():
}
 
1. Class Human:
  • Fields: age(int), weight(double), height(double)
  • Methods: getAge, getWeight, getHeight

2. Class Student:

  • Fields: major (String), gpa (double), creditHours (int)
  • methods: getMajor: returns major, getGpa: returns gpa, getYear: returns freshman, sophmore, junior, senior as determined by earned credit hours
  • Freshman : less than 32 credit hours
  • sophmore: at least 32 but less than 64 credit hours
  • junior: at least 64 credit hours but less than 96 credit hours
  • senior: at least 96 credit hours

3.Class Doctor:

  • Fields: years(int), Speciality (String)
  • methods: getYears: returns years, getSpeciality: returns speciality, getSalary: calculates salary. base salary is 40,000 for the first year and for each additional year gets 5000 more. so in second year doctor gets 45000 and so on.

4. Write another client class.

  • create an object of class Student
    • Called Alex whose major is CS, GPA is 3.4, credit hours is 54, height is 170 cm, weight is 150 pounds and age is 18.
  • create an object of class Doctor
    • called Jack whose speciality is "Dermatology", years is 4, height is 173 cm, weight is 179 pounds and age is 40.
  • print out the students major, gpa, year, and age
  • print out the doctor's speciality, height, weight, and salary.
Mammal
Human
Student
Doctor
Transcribed Image Text:Mammal Human Student Doctor
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Introduction to Interface
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education