Lab05-OOP
Lab05-OOP
Excercise1:
1- Create a super class called Car. The Car class has the following fields and methods:
int speed;
double regularPrice;
String color;
2- Create a subclass of Car class and name it as Sedan. The Sedan class has the following
fields and methods:
int length;
3- Create a sub class of Car class and name it as Truck. The Truck class has the following
fields and methods:
int weight;
4- Create a subclass of Sedan class and name it as HondaSedan. The HondaSedan class has
the following fields and methods:
int year;
int manufacturerDiscount; //fixed amount, NOT a percentage
int year;
int manufacturerDiscount; //fixed amount, NOT a percentage
6- Create MyOwnAutoShop class which contains the main() method. Perform the
following within the main() method:
i) Create an instance of Car class and initialize all the fields with appropriate values.
ii) Create an instances of the Sedan class and initialize all the fields with appropriate
values.
iii) Create two instances of the Truck class and initialize all the fields with appropriate
values.
iv) Create an instance of HondaSedan class and initialize all the fields with appropriate
values.
v) Create an instance of GMCTruck class and initialize all the fields with appropriate
values.