Question
Write this code using JAVA langauge Objective: Write a classes that represents a vehicle system First download the driver and put it in your project
Write this code using JAVA langauge
Objective:
Write a classes that represents a vehicle system
First download the driver and put it in your project
DO NOT ALTER THE DRIVER!
Regarding .equals(): Just go ahead and take a Vehicle/Car/Truck parameter this is not really the normal way: see https://www.sitepoint.com/implement-javas-equals-method-correctly
Write a class file called Vehicle
Some of the attributes are
Manufacturers name
Number of Cylinders (must be greater than 0)
Owners name
Create the following Constructors
Default sets everything to default values
Parameterized Constructor
Check for valid values
Accessors and Mutators for each variable
MAKE SURE THE MUTATORS CHECK FOR VALID VALUES!
Create the following Methods
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 Manufacturers name, number of cylinders, and the owners name
Write another class Truck which is a Vehicle
Some of the attributes of Truck are
Load capacity: a nonnegative number of tons represented by a decimal number
Towing capacity: a nonnegative number of tons represented by a decimal
Create the following constructorsDefault sets everything to default values
This includes calling the Vehicles default constructor
Parameterized Constructor
This must also take in via parameter the manufacturers name, number of cylinders, and the owners name in addition to the load and towing capacity.
Accessors and Mutators for each variable
MAKE SURE THE MUTATORS CHECK FOR VALID VALUES!
Create the following methods
equals This should override the vehicles equals method return true if all the properties of vehicle and truck are equal
toString This should also override the vehicles toString method and also return the Vehicles toString along with the towing and load capacity
Write another class Car which is a Vehicle
Some of the attributes of Truck are
Gas Mileage: a nonnegative number of gallons represented by a decimal number
Number of passengers: a nonnegative number of passengers represented by a whole number
Create the following constructorsDefault sets everything to default values
This includes calling the Vehicles default constructor
Parameterized Constructor
This must also take in via parameter the manufacturers name, number of cylinders, and the owners name in addition to the load and towing capacity.
Accessors and Mutators for each variable
MAKE SURE THE MUTATORS CHECK FOR VALID VALUES!
Create the following methods
equals This should override the vehicles equals method return true if all the properties of vehicle and car are equal
toString This should also override the vehicles toString method and also return the Vehicles toString along with the gas mileage and number of passengers
cse.sc.edu | Lab 24 Chegg Study Guided Solutions and Study Help Chegg.com Lab 24 Fleet of Vehicles Objective: Write a classes that represents a vehicle system First download the driver and put it in your project DO NOT ALTER THE DRIVER Regarding equals0: Just go ahead and take a Vehicle/Car/Truck parameter... this is not really the normal way: see https://www.sitepoint.com/implement-javas-cquals-method-correctly Write a class file called Vehicle e Some of the attributes are o Manufacturer's name o Number of Cylinders (must be greater than 0) o Owner's name . Create the following Constructors o 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 o 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 e 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 o Default- sets everything to default values o Parameterized Constructor Create the following constructors This includes calling the Vehicle's default constructor This must also take in via parameter the manufacturer's name, number of cylinders, and the owner's name in addition to the load and towing capacity Accessors and Mutators for each variable o MAKE SURE THE MUTATORS CHECK FOR VALID VALUES! Create the following methods
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