Question: Create a class called CA VD 1 9 R with the variables as fuel _ capacity, mileage of appropriate datatype. Create a constructor to initialize

Create a class called CA VD19 R with the variables as fuel_capacity, mileage of appropriate datatype. Create a constructor to initialize the declared variables. Declare and define a method called distance_covered by multiplying fuel_capacity and mileage as (distance_covered = fuel_capacity * mileage) and return the same. The subclass called TOYOTA extending from CAR has already been created for you as follows. public class TOYOTA extends CAR { double distance_travelled; public TOYOTA (int x , int y , int z ){ super ( x , y ); distance_travelled = z; } public double remain_kms(){ return ((fuel_capacity * mileage)- distance_travelled ); }} Write the main method and create appropriate objects along with the arguments to be sent to the methods and print the output as follows.

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 Programming Questions!