The class diagram with four classes Student, Graduate, Undergraduate, and Exchange is given. Write the classes as described in the class diagram. The fields and methods for each class is given below. Student: Fields: major (String) gpa (double) creditHours (int) Methods: getGpa: returns gpa getYear: returns a String of “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 64 but less than 96 credit hours Student Exchange Graduate Undergraduate • 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: getYears: returns years (this is an integer, not like the student…) getConcentration: returns concentration (ex: Data Science, NeuroScience, Bioinformatics, Cybersecurity, etc.) Undergraduate: Fields: honors (Boolean) Methods: isHonors: returns honors (TRUE or FALSE) Exchange: Fields: country (String) year(String) (start date of the exchange program, stores Fall, Spring or Summer followed by the year e.g., Fall 2020) Methods: getYear: returns year (String) getCountry: returns country • Write a client class, called StudentClient. • Create an object of class Undergraduate called Alex whose major is CS, gpa is 3.9, credit hours = 54, and honors = TRUE. • Create an object of class Graduate called Mary whose degree is “Masters”, years = 1, gpa is 3.91, major = “Computer Science” and concentration is “Data Science”. • Print out Alex’s major, gpa, year, and use isHonors method to see if the he is an honors student. • Print out Mary’s major, concentration, and years spent in graduate school. • Create an object of class Exchange called YingShu, for an exchange student with Fall 2020, from Tiawan, and print out their gpa, major, and country. hint: you can override toString() to print things and combine with parent classes

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

The class diagram with four classes Student, Graduate, Undergraduate, and Exchange is
given. Write the classes as described in the class diagram. The fields and methods for each class
is given below.
Student:
Fields: major (String)
gpa (double)
creditHours (int)
Methods:
getGpa: returns gpa
getYear: returns a String of “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 64 but less than 96 credit hours
Student
Exchange
Graduate
Undergraduate
• 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:
getYears: returns years (this is an integer, not like the student…)
getConcentration: returns concentration (ex: Data Science, NeuroScience,
Bioinformatics, Cybersecurity, etc.)
Undergraduate:
Fields: honors (Boolean)
Methods:
isHonors: returns honors (TRUE or FALSE)
Exchange:
Fields: country (String)
year(String) (start date of the exchange program, stores Fall, Spring or Summer followed
by the year e.g., Fall 2020)
Methods:
getYear: returns year (String)
getCountry: returns country
• Write a client class, called StudentClient.
• Create an object of class Undergraduate called Alex whose major is CS, gpa is 3.9,
credit hours = 54, and honors = TRUE.
• Create an object of class Graduate called Mary whose degree is “Masters”, years = 1,
gpa is 3.91, major = “Computer Science” and concentration is “Data Science”.
• Print out Alex’s major, gpa, year, and use isHonors method to see if the he is an honors
student.
• Print out Mary’s major, concentration, and years spent in graduate school.
• Create an object of class Exchange called YingShu, for an exchange student with Fall
2020, from Tiawan, and print out their gpa, major, and country.
hint: you can override toString() to print things and combine with parent classes

The image displays a hierarchical diagram illustrating different categories of students. At the top of the hierarchy is the category labeled "Student." There are two branches extending from this category:

1. **Graduate**
2. **Undergraduate**

Under the "Undergraduate" category, there is an additional branch leading to a sub-category labeled "Exchange."

This diagram explains the classification of students into two main types: Graduate and Undergraduate, with a further distinction for undergraduates who participate in exchange programs.
Transcribed Image Text:The image displays a hierarchical diagram illustrating different categories of students. At the top of the hierarchy is the category labeled "Student." There are two branches extending from this category: 1. **Graduate** 2. **Undergraduate** Under the "Undergraduate" category, there is an additional branch leading to a sub-category labeled "Exchange." This diagram explains the classification of students into two main types: Graduate and Undergraduate, with a further distinction for undergraduates who participate in exchange programs.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 6 images

Blurred answer
Similar 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