Question: Create a class called University. A University is described by three pieces of private information as instance variables: the university name (String), students Count that

 Create a class called University. A University is described by three

Create a class called University. A University is described by three pieces of private information as instance variables: the university name (String), students Count that represents the total number of students (int), and the yearly fees (double). Provide a set and a get method for each instance variable. For the setters: if the students Count is not positive, it should be set to 1000. If the yearly fees is not positive, it should be set to 15000.0. Your class should have one constructor that properly initializes the three instance variables. In addition, provide a method named getTotalFees() that calculates the total yearly fees amount (i.e. multiplies the students Count by the yearly fees), then returns the result as a double value. Write an application named University Test to test University class. In the University Test do the following: 1. Create a university instance with these details: Qatar University", studentsCount = 8000 and yearlyFees = 15000 Riyals. 2. Print details of the above university and their total yearly fees, properly labeled (show two digits after the decimal point of yearly fees and total yearly fees). 3. Create another university instance for: New York University, studentsCount = 50000 and yearlyFees = - 500 Riyals (yes, the value is negative). 4. Print the name and the total yearly fees for this instance. s. Using a getter and a setter, set the yearlyFees for the New York University to be 10 times the yearlyFees of Qatar University. 6. Re-print the name and the total yearly fees of the second instance after setting the yearlyFees

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!