Reference no: EM133325160
Computer Programming (JAVA)
Question 1. The following UML Class Diagram is provided. Implement all the classes in the Class Diagram. Staff class is abstract with abstract methods getPaid and toString methods are calculated as follows:
For Manager, returns the sum of salary and allowance.
For Technician, returns the sum of salary and overTimePay.
The toString methods return the following String:
o For Manager, returns name, salary, allowance, and paid in a String.
Sample: Manager: name = Siti, salary = 4000.0, allowance = 1500.0, paid = 5500.0
o For Technician, returns returns name, salary, over.mePay, and paid in a String
Sample: Technician: name = Ali, salary = 2000.0, overtimePay = 1200.0, paid = 3200.0

Question 2. Write class Employee that has fields for employee's name, ID, and salary. The Employee class has also another field called address which is of type class Address. Class Address has fields for the street name, house number, and city. Include in class Employee any suitable accessor and mutator methods and write a method called displayInfo that display all information of an Employee.
Question 3. A hospital wants to create a database regarding its indoor patients. The information to store include
- Name of the patient
- Age of the patient
- Disease
- Date of admission
- Date of discharge
Create a class called Patient to store the above information. The member methods should include methods to enter information and display the patient's information.
Create class Date to have the date (year, month and day as its fields) and a method to display the date.
Create class Hospital to have an array list to store all patients. It has methods to add a patient to the list and
to delete a patient from the list. It also has a method to display a list of all the patients in the hospital and a method to display only the patients whose age is less than 12.
Question 4. Create a class named Movie that can be used with your video rental business. The Movie class should track the Motion Picture Association of America (MPAA) rating (e.g., Rated G, PG-13, R), ID Number, and movie title with appropriate accessor and mutator methods. Also create an equals() method that overrides Object 's equals() method, where two movies are equal if their ID number is identical. Next, create three additional classes named Action , Comedy , and Drama that are derived from Movie . Finally, create an overridden method named calcLateFees that takes as input the number of days a movie is late and returns the late fee for that movie. The default late fee is $2/day. Action movies have a late fee of $3/day, comedies are $2.50/day, and dramas are $2/day. Test your classes from a main method.
Question 5. Consider the following class hierarchy where Class Car is the supper class and the classes ClassicCar and
SportCar are two subclasses derived from Car.
Class CarExhibition contains a filed of type ArrayList that stores objects of type Car.

a. Class Car is an abstract class .Write a Java version of class Car assuming it has this constructor:public Car(double price, int year) and that the method calculateSalePrice ( ) is abstract.
b. Write a Java version of class ClassicCar assuming it has this constructor: public ClassicCar (double price, int year) and that the method calculateSalePrice ( ) returns 10,000 as the sale price of the car.
c. Write a Java version of class SportCar assuming it has this constructor: public SportCar(double price, int year)
and that the method calculateSalePrice ( ) calculates the sale price of the car as follow:
if year > 2000 then the sale price is 0.75 * its original price; if year > 1995 then the sale price is 0.5 * its original price; otherwise the sale price is 0.25 * its original price
d. Write a Java version of class CarExhibition assuming it has this constructor: public CarExhibition( ) where CarExhibition has cars of different types stored in an arraylist and getTotalPrice method that returns the total prices of all cars in the exhibition.