Question: PLEASE CODE IN JAVA PLEASE POST OUTPUT AS WELL Task 3: Given the following inheritance hierarchy and the definition for the Rental, Limo and MPV




PLEASE CODE IN JAVA PLEASE POST OUTPUT AS WELL
Task 3: Given the following inheritance hierarchy and the definition for the Rental, Limo and MPV classes: abstract class Rental { private String name; // customer's private String plateNum; // Vehicle plate number name public Rental 0 1} public Rental (1) method definition } // normal constructor public String getName() { // method definition } //accessor public String getplats (){ // method definition } // accessor public String testring() { // method definition } // printer // abstract method to calculate the rental charges public abstract double salcharged); } class MPV extends Rental i private int day; // number of days private String model; // car model public MPV () { } public MPV Gel / method definition }// normal constructor public int getDax() { // method definition } //accessor public String getModel() { // method definition }//accessor public String testring() { // method definition } //printer // method to calculate the rental charges public double calchargest) { // method definition } } class Limo extends Rental { // either require the chauffer service or not. private keglean chauffer; private int hour; // number of hours public final double HOURLY = 200.00;// rental charges per hour public Lime () { } public Limo tu/ method definition } // normal constructor public int set Hour () { // method definition } //accessor public beatean get chauster() { // method definition } }//accessor public String testring() { // method definition } }//printer // method to calculate the rental charges public double salchargest) { // method definition } } a) Write abstract methods of calCharges (to calculate the rental charges for both subclasses. The formulas are given below: charges for limo = hour x HOURLY + chauffer charges charges for MPV = number of days x rental charges where: the charges for the chauffer service is RM100 per hour; the rental charges are based on the car model as shown in the table below: 2 Car Model Rental charges per day (RM) Toyota Estima 400.00 Kia Nazaria 350.00 b) Write a Java application that uses the concept of polymorphism to perform the following: I. II. III. declare an array of objects to store data on various types of Rental; input and store data for both Limo and MPV objects; display the details of customers who have rented the MPV services for more than 7 days; calculate and display the total rental charges of all Limo services; count the number of customers who require the chauffer services and display their details. IV. V
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
