Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Code 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 parametersStep 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