Question: Write a Java program for a vehicle class (super/parent class) and Taxi class (sub/child class) as per the UML diagram given below. Please use the

 Write a Java program for a vehicle class (super/parent class) and

Taxi class (sub/child class) as per the UML diagram given below. Please

Write a Java program for a vehicle class (super/parent class) and Taxi class (sub/child class) as per the UML diagram given below. Please use the principles of inheritance while declaring classes. Class Instance Variables Vehicle make; String model; int year, int mileage; int plateNumber; String numSeats; int Constructors : +Vehicle (make: String, model: int, year: int, mileage: int, plateNumber: String, numSeats: int) +Vehicle (make: String, model: int, year: int, numSeats: int) default values: mileage "unknown" 0; plateNumber: +getMake(): String +getModelo: int +getYear(): int +getMileage(): int +getPlateNumber(): String +getNumSeats: int +setMileage(int mileage): void setMileage: new mileage cannot be less than previous mileage +setPlateNumber(String plateNumber): void +toString: String toString0: Prints make, model and mileage Taxi (inherits Vehicle class) Class All fields of Vehicle class are inherited and have Instance Variables these additional fields. taxild; fare Total; numFares; String double int Constructor: +Taxi (make: String, model: int, year: int, mileage: int, plateNumber: String, numSeats: int, taxild: String) default values: fare Total = 0.0, numFares: 0 getIDO: gives taxi ID +getIDO): String +setID(String newID): void +getFare Total(): double +addFare(double Fare): void +getNumFares: int +getAverageFare (: double getFare Total: gives total fare addFare(): to add new fare to existing fare getNumFares: to give total number of fares get rageFar gets the average of fare +resetFare Info(): void +toString(: String (Overridden method) resetFareInfo(): resets Fare, NumFares to zero toString(: adds Taxild to toString() method of berent

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