Question: Define a Car class Code Needed In Java Please. Your car class should have the following: Fields a string for the make a string for

Define a Car class

Define a Car class Code Needed In Java Please. Your car class

should have the following: Fields a string for the make a stringCode Needed In Java Please.

Your car class should have the following: Fields a string for the make a string for the model an integer for tank size in gallons a double for miles per gallon Methods setters and getters for all fields (getMake, setMake, getModel, setModel, getTankSize, setTankSize) equals takes a Car as a parameter. The car object running the method (Car A) compares its make and model with the make and model of the car given as the parameter (Car B). It returns true if they are the same, false otherwise compare TankSize takes a car as a parameter. The car object running the method (Car A) compares its tank capacity with the capacity of the car given as the parameter (Car B). It returns 0 if A's tank capacity equals B's tank capacity, a positive number if A's is greater than B's, and negative if A's is less than Bs compareMPG takes a Car as a parameter. The car object running the method (Car A) compares its mpg with the mpg of the car given as the parameter (Car B). It true if A's mpg is within.001 difference of B's mpg and false otherwise Constructors a constructor that takes make and model as parameters. capacity should be set to 20.mpg should be set to 29 . a constructor that takes make, model, capacity, and mpg as parameters

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!