Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced MySQL 8 Discover The Full Potential Of MySQL And Ensure High Performance Of Your Database

Authors: Eric Vanier ,Birju Shah ,Tejaswi Malepati

1st Edition

1788834445, 978-1788834445

More Books

Students also viewed these Databases questions

Question

What are Fringe Benefits ? List out some.

Answered: 1 week ago