Implement a superclass vehicle and subclass car and truck a


Implement a superclass Vehicle and subclass Car and Truck. A vehicle has a position on thescreen. Write a method draw that draw cars and trucks as follows:CarTruckThen write a method randomVehicle that randomly generates Vehicle references, with anequal probability for constructing cars and trucks, with random positions. Call it 10 timesand draw all of them.Hint: You will need the following lilibraries:

import java.awt.Graphics2D;

import java.awt.Rectangle;

import java.awt.geom.Ellipse2D;

import java.awt.geom.Line2D;

import java.awt.geom.Point2D;

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Implement a superclass vehicle and subclass car and truck a
Reference No:- TGS02392235

Now Priced at $10 (50% Discount)

Recommended (93%)

Rated (4.5/5)