17. You are to design a program that simulates a vending machine. Your desien mi
ID: 3839923 • Letter: 1
Question
17. You are to design a program that simulates a vending machine. Your desien might incude a ofthe foaowire a. Product c. VendingMachine e. ChangeMachol Why? 18. Aused car lot contains cars of various makes and models. The size of acar lot is fixed. The owner of the car lot wants to inventory the cars he has available. For the inventory, he/she needs the following information ab each car: Make NToyota, Ford, etc.) Year (1997, 2001, etc.) Mileage (120734.6, 2355s.2, etc.) Cost (20000.00, 24500.00, etc.) When a new car is created, the make, the car year, and the mileage are given. The cars are occasionally taken for test rides. A test ride alters the mileage of the car. The price ofthe car is set by the owner of the car lot. The car dealer will eventually need to print all of the information about each car inthe lot Itwill also be necessary for the car dealer to request and print a list of all cars with a specified year and make. Implement the Car class. In implementing the class, you should: Choose appropriate variable names, parameter names, and method names. Properly identify access modifiers (private, public) of each method and instance field- Include a toString 0 that will print the information about a car. Consider the Cartot class partially implemented below. public class Carlotf public CarLot (00 lot new CarlMAX CARS]; //Prints the information about the cars in the car lot. public void addCar (car aNewCar)--1 public void printCarslnLot (00-) Falls the array list with cars in the car lot that have the same year and make as the parameters passed to the method. private Arraylistccan rs (int year, String make)(-) Prints the year, make, mileage, and price of each car in the lot that has the same year and make as the method parameters public void printMatchingcars (int year, String make)-)Explanation / Answer
A17) When we design a program that simulates a vending machine the Design will include the Product which gives the information of product availble in the machine.Coin will have the information about the legal denomine allowed. Change machine will have information about the change to display back.and the vending machine to dispatch the product.
The design will not include Customer, because there is no point in storing any information about customer and Vending machine task is take the coin and dispatch the product.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.