CSC 220 – Lab 10

$30.00

Category: Tags: , , , , You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (4 votes)

Suppose that we are required to model students and teachers in our application. We can
define a superclass called Person to store common properties such as name and address,
and subclasses Student and Teacher for their specific properties. An object of the type
CourseTaken is used to store a course a student takes and the grade the student gets for
this course. For students, we need to maintain the courses taken and their respective
grades using the class CourseTaken; add a course with grade, print all courses taken and
the average grade. A student takes at least 5 courses. For teachers, we need to maintain 2
courses taught currently.
The UML diagram for Person and its subclasses is as follows:
According to the requirement, implement these three classes. Write a Test driver class
that does the following:
1. Create a student object s with your name and your address.
2. Print out the information of object s.
2
3. Add 6 courses with grades for each of the courses for student s.
4. Print out the grades and the average grade of student s.
5. Create a teacher t with one of your teachers’ name and an address.
6. Print out the information of object t.
7. Set two courses that teacher t teaches.
8. Print out the courses that teacher t teaches.
What to turn in:
JAR your *.java files into a file called Lab10.jar. When you’re done, submit
the file to Canvas by the deadline. No extensions.