SDEV 2210 Project. This project simulates the inventory for a fleet of cars. The fleet is an array of Car objects. A Car has a name and an ArrayList of Miles Per Gallon (MPG) objects. An MPG object has variables for miles, gallons, and miles per gallon, which is calculated in the constructor. The driver class will instantiate 3 Car objects and store them in an array, then add anonymous MPG objects to the ArrayList of MPG objects for each Car. This will be coded directly in the driver, no user input at this point. Using a For-Each loop, the project displays the name of the car, its total MPG and a count of the number of trips for each car. Next, the program asks the user if they want to see the MPG for the individual trips for a single car. If the answer is yes, the user enters any part of the name of the car of interest. Using another For-Each loop, the program goes through the cars to see if the input string appears anywhere in the name of the car, and when it is found, displays each of the MPG objects for that car. You may use any car names you want, and any number of trips for each car. Make sure there are different numbers of trips – look at the example, where it shows 5, 3, and 4 trips. You must have 2 classes and the driver class. Be sure to use For-Each loops to list the fleet inventory, to find the specific car, and to print the individual trips. The miles and gallons must be added to the MPG array list using anonymous objects. Run the project and take a screenshot.
== We're Using GitHub Under Protest ==
This project is currently hosted on GitHub. This is not ideal; GitHub is a proprietary, trade-secret system that is not Free and Open Souce Software (FOSS). We are deeply concerned about using a proprietary system like GitHub to develop our FOSS project. We have an open {bug ticket, mailing list thread, etc.} where the project contributors are actively discussing how we can move away from GitHub in the long term. We urge you to read about the Give up GitHub campaign from the Software Freedom Conservancy to understand some of the reasons why GitHub is not a good place to host FOSS projects.
If you are a contributor who personally has already quit using GitHub, please check this resource for how to send us contributions without using GitHub directly.
Any use of this project's code by GitHub Copilot, past or present, is done without our permission. We do not consent to GitHub's use of this project's code in Copilot.