Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This is the code for the driver. This is NOT meant to be modified! import java.util.Scanner; //A class that keeps a fleet of different types
This is the code for the driver. This is NOT meant to be modified!
import java.util.Scanner; //A class that keeps a fleet of different types of vehicles public class FleetOfVehicles { //An array of vehicles private Vehicle[] fleet; public static final int MAX_VEHICLES = 100; public FleetOfVehicles() { fleet = new Vehicle[MAX_VEHICLES]; } public Vehicle[] getFleet() { return this.fleet; } //Adds a new vehicle to the first empty spot in the fleet array public void addVehicle(Vehicle aV) { for(int i=0;iObjective: Write a classes that represents a vehicle svstem First download the driver and put it in your project DO NOT ALTER THE DRIVER! Write a class file called Vehicle . Some of the attributes are Manufacturer's name o Number of Cylinders (must be greater than 0) Owner's name . Create the following Constructors Default - sets everything to default values o Parameterized Constructor Check for valid values Accessors and Mutators for each variable o MAKE SURE THE MUTATORS CHECK FOR VALID VALUES! . Create the following Methods o equals - takes in another instance of a Vehicle and returns true only if the names and the number of cylinders are equal tostring-returns a String that contains the Manufacturer's name, number of cylinders, and the owners name Write another class Truck which is a Vehicle . Some of the attributes of Truck are o Load capacity: a nonnegative number of tons represented by a decimal number o Towing capacity: a nonnegative number of tons represented by a decimal . Create the following constructors
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started