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 VD R with the variables as fuelcapacity, mileage of appropriate datatype. Create a constructor to initialize the declared variables. Declare and define a method called distancecovered by multiplying fuelcapacity and mileage as distancecovered fuelcapacity 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 distancetravelled; public TOYOTA int x int y int z super x y ; distancetravelled z; public double remainkms return fuelcapacity mileage distancetravelled ; 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
