Write a program to create a class named Vehicle with attributes price, mileage and fuel and an
Fantastic news! We've Found the answer you've been seeking!
Question:
Write a program to create a class named Vehicle with attributes price, mileage and fuel and an initializer to initialize all the instance variables. Vehicle class must have a method getFuel() which returns the fuel and a method addFuel() to add the fuel. Create a subclass of Vehicle named Car with attribute car_name. Override the addFuel() method. Also override the getFuel() method in Car class to display the name of the Car and return the available fuel.
Related Book For
Data Structures and Algorithm Analysis in Java
ISBN: 978-0132576277
3rd edition
Authors: Mark A. Weiss
Posted Date: