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.
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
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.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
Knowledge Booster
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.Recommended textbooks for you
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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education