Question: Java Create sub classes that overrides a member method from a super class. Follow the instructions below. Define a class, with an identifier of Car,



Java
Create sub classes that overrides a member method from a super class. Follow the instructions below. Define a class, with an identifier of Car, with four member fields: String make, String model, double price, int mileage Define one member method: void display() Within display(), print out the values of all the member fields. Format price to 2 decimal places with a dollar sign in front by using printf("\%.2f"). Define a class, with an identifier of SportsCar, that is a sub class for the Car class with one member field: boolean hasAccessories Define one member method: void display() Within display(), print out the values of all the member fields (including the member fields in the Car class). Remember to use super to get the member fields in the Car class. Remember that display() from the SportsCar class is overriding display() from the Car class. Define a class, with an identifier of MiniVanCar, that is a sub class for the Car class with one member field: boolean hasAutomaticSlidingDoor Define one member method: void display() Within display(), print out the values of all the member fields (including the member fields in the Car class). Remember to use super to get the member fields in the Car class. Remember that display() from the MiniVanCar class is overriding display() from the Car class. Define a class, with an identifier of Lab10, that contains the necessary main member method to run the program. Within the main member method, declare and instantiate an instance of the SportsCar and MiniVanCar class. Call display() from the SportsCar and MiniVanCar class. Make: Dodge Model: Charger Price: $75000.00 Mileage: 7500 Has Accessories?: false Make: Kia Model: Carnival Price: \$21500.99 Mileage: 56138 Has Automatic sliding Door?: true Lab10.java, Car.java, SportsCar.java, MiniVanCar.java source code
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
