Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4. (7 points) Define abstract classes Vehicle and LandVehicle, a concrete class Auto and Interface Drivable according to the following UML diagram. Create a driver

image text in transcribed
4. (7 points) Define abstract classes Vehicle and LandVehicle, a concrete class Auto and Interface Drivable according to the following UML diagram. Create a driver in which the following lines code will be realized without errors System.out.println("All kinds of cars: "); Auto myAuto - new Auto ("Kia"); System.out.println(" myAuto = " + myAuto); Vehicle myCar = new Auto ("sedan"); Drivable drive = myCar; System.out.println(" myCar = " + drive); Landvehicle mySedan = new Auto ("Honda"); drive - mySedan; System.out.println(" mySedan = " + drive); Output: All kinds of cars: Vehicle #type: String + Vehicle +Vehicletype : String) + getType: String +toStringo String myAuto - Auto Completed Safe Driving School Has insurance: true Has registration: true Has valid Lisence: false Land Vehicle Type of vehicle: Kia > cestereotype>> Drivable interface) Land vehicle + DRIVER String = "Niko + SafeDrivingo : String + hasinsurance : boolean + isRegistered): boolean + hasValid License: boolean +Landvehicle +LandVehicletype : String) +toString: String myCar - Auto Completed Safe Driving School Has insurance: true Has registration: true Has valid Lisence: false Land Vehicle Type of vehicle: sedan Auto Auto(type: String) + to Stringo: String + safeDriving: String + hasinsurance, boolean + hasValid License:boolean + is Registered:boolean mySedan = Auto Completed Safe Driving School Has insurance: true Has registration: true Has valid Lisence: false Land Vehicle Type of vehicle: Honda

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

Intelligent Databases Technologies And Applications

Authors: Zongmin Ma

1st Edition

1599041219, 978-1599041216

More Books

Students also viewed these Databases questions

Question

where should the data be stored

Answered: 1 week ago