Skip to content

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 arr…

License

Notifications You must be signed in to change notification settings

bell-kevin/fleetInventory

Repository files navigation

fleetInventory

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. Submission: the specified screenshots, and the root folder for the project Pay careful attention to the rubric for this assignment. Remember the standards that apply to every project. Note that you must use correct formatting in the code -- appropriate indentation is most important. You can use Shift-Alt-F to have NetBeans automatically format the code correctly. If the formatting is incorrect, it will be returned to you for changes with a grade of zero. Note: You need to submit the whole project for these assignments. In File Explorer, go to the location where you created the project. There will be a folder with the name of your project -- that is the root folder of the project. If you submit the root folder of the project, the instructor can run it on a different machine to grade it. If you don't submit the proper folder, it won't run on another machine, and the assignment will be marked with a zero

== 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.

Logo of the GiveUpGitHub campaign

About

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 arr…

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages