Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem Description : You will be writing classes that represent various parts of a vending machine. You will need to write two files: VendingMachine.java and
Problem Description: You will be writing classes that represent various parts of a vending machine. You will need to write two files: VendingMachine.java and VendingItem.java. A simple driver class VendingWorld.java (https://cs1331.gitlab.io/fall2018/hw3/VendingWorld.java) has been provided, and it will allow you to interact with your simulation within the command line/terminal.
ascii table (https://www.cs.cmu.edu/~pattis/15-1XX/common/handouts/ascii.html)
Solution Description Vendingltem.java (enum) Instances of this enum will represent items in your vending machine. Your boss at Coke has done extensive analysis and determined that the following items and prices are ideal for Georgia Tech students: Item Price Lays $1.50 Doritos $1.50 Coke $2.50 Ramblin_Reck_Toy $180.75 Rubiks Cube $30.00 Rat_Cap $15.00 FASET_Lanyard Graphing Calculator $120.00 UGA_Diploma $10.00 $0.10 Pie $3.14 Clicker $55.55 Cheetos $1.25 Sprite $2.50 Red Bull $4.75 Ramen $3.15 Cold Pizza $0.99 The names of the elements in your enum should be exactly as they appear here, and the price should be a parameter to the enum constructor. Your VendingItem enum should have the following fields, methods, and constructors: private final double price. This field is the price of an item, and should be set in the constructor. VendingItem(double price). This is the constructor for the enum type, and it takes the price as its single parameter. Review the links and details in the Background section if this confuses you. public double getPrice(). This method is just a simple getter method for the price. price is final and has no setter because it does not make sense for an object's price to change at runtime. public String tostring(). This method returns a string representation of a VendingItem for use in your simulation. The string should look like: "(name): $xx.xx" where (name) is the name of the vVendingItem and xx.xx is its price.
Step by Step Solution
★★★★★
3.31 Rating (139 Votes )
There are 3 Steps involved in it
Step: 1
Implementation for VendingItem Enum Add all the items provided here in list not copied all of them p...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