The document outlines the creation of three classes: University, Classroom, and Student, each with specific attributes and relationships. The University class contains a name and two Classroom instances, while each Classroom has a number of chairs, an AverageGPA, and four Student instances. The Student class includes a name and GPA, and all classes must implement a constructor for initialization and a toString method for description.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
4 views1 page
Lab 5n
The document outlines the creation of three classes: University, Classroom, and Student, each with specific attributes and relationships. The University class contains a name and two Classroom instances, while each Classroom has a number of chairs, an AverageGPA, and four Student instances. The Student class includes a name and GPA, and all classes must implement a constructor for initialization and a toString method for description.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1
Objectify the World
Create a University, Classroom and Student classes. The University has
a name as a String, and 2 instances of Classroom. A Classroom has a number of chairs as integer and 4 instances of Student. A Classroom also has an AverageGPA as a floating-point number which is the average GPA of all its students. A Student has a name as a String and a GPA as a floating-point number.
All Objects must initialize their variables in the constructor.
All classes must have a toString method that describes them and all their instance variables.
Write a program that prints a University.
(provide any values of your choice in the main function like the name of the university, GPAs of students, etc)