Question: US) https://cis.temple.edul-ifiore/2018/fall/1068/assignments/08 anvas course Hero 1 Wel. D JAVA class S Discrete Mathema S Security Shepherd Free Tests for inte... Warm Up with Objects Due:



US) https://cis.temple.edul-ifiore/2018/fall/1068/assignments/08 anvas course Hero 1 Wel. D JAVA class S Discrete Mathema S Security Shepherd Free Tests for inte... Warm Up with Objects Due: Wednesday, October 31 60 points Cars (25 points) Implement a class car, which contains the field make, e.g. Ford, Subaru, Toyota node1, e-g. Escape, Outback, Camry. * year . HPG miles per gallon nilesDriven, the total number of miles ever driven in this car. fue1Capaeiey in gallons, ie, the size in gallons of the fuel tank fuelRemsining, which represents the amount of fuel remaining in the gas tank Implement at least the following methods within the car class: . a constructor, which initializes each of the fields tillTank double g, which adds up to g gallons of gas to the fuel tank, but not more than the car's fuel . driweidoubie m), which simulates driving a miles in the car, adding to the total number of miles driven, and reducing the amount of gas in the car according to this car's average MPG tostringt , which returns a string representation of the car. " getPuel LRenainingt , which returns the amount of fuel let in the tank For example, we should be able to do something like the following: // creates a new Car object: a 1972Ford Pinto, which geta 1T.2 MPG, has been driven 123,621 niles. It has a gas tank that ean hold 12 gallons of gas, but it only has 8 gallons in it Car oldJunker nev Car( Ford "Pinto". 1972, 17.5, 127621, 12, 8 o1dJunker.drive15i idrives the Pinto 5 niles oldJunker.filltank(1 put in a gallon of gas Systen.out-printin(oldJunker.getPuelRenaining(): prints the anount ot tuel lett Systen.out-println(oldJunkeri printa the attribates of the car ta the screen Write a short driver program to test your Car class with a short array of Cars
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
