Problem Description : You will be writing classes that represent various parts of a vending machine. You
Fantastic news! We've Found the answer you've been seeking!
Question:
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)
Transcribed Image Text:
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. 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.
Expert Answer:
Answer rating: 100% (QA)
Implementation for VendingItem Enum Add all the items provided here in list not copied all of them p... View the full answer
Related Book For
Introduction to Probability
ISBN: 978-0716771098
1st edition
Authors: Mark Daniel Ward, Ellen Gundlach
Posted Date:
Students also viewed these programming questions
-
For this assignment, you will be writing a 1200-1500 word essay on EITHER The Tempest or A Tempest (Une Tempte) on ONE of the attached four topics. This is to be submitted on Blackboard through...
-
Write a Complex Office Legal Memorandum based on the fact pattern set out below. The client, Patrick Picard, a 20-year-old with no prior criminal history, spray-painted his "tag" after midnight on...
-
11.) What is the result of the following: int f = 9; double answer; answer = (double) f/3; f/= 3; System.out.println ("answer is: " + answer); System.out.println("f is: " + f);
-
A heating contractor must heat 0.2 kg/s of water from 15C to 35C using hot gases in cross flow over a thin-walled tube. Your assignment is to develop a series of design graphs that can be used to...
-
If the firms average cost curves are U-shaped, why does its average variable cost curve achieve its minimum at a lower level of output than the average total cost curve?
-
I dont understand how I can go from a profit to a loss when I sell more units. This comment aptly sums Emily Johnsons frustration with her accounting statements. Emily owns and operates a small firm...
-
Refer to the information in QS 13-4. Use that information for Tide Corporation to determine the 2016 and 2017 common-size percents for cost of goods sold using net sales as the base. Data From QS...
-
Using the data in the student spreadsheet file P&G.xlsx (to find the student spreadsheets for Financial Analysis with Microsoft Excel, seventh edition, go to www.cengagebrain.com) forecast the June...
-
Bleeker Street Pizza and Keste Pizza & Vino are located close to each other on Bleeker Street in the West Village. There are 450 potential customers every day, and suppose that each of them is...
-
Which statement concerning TQM in services is false a Service quality often depends upon the courtesy of the sales person b Service quality often depends upon how problems are handled c Service...
-
ABC Company discovered an inventory error in its records. The company's physical count of inventory revealed a quantity of 500 units, while the recorded quantity in the books was 450 units. The cost...
-
Consider a levered investment in AMD stock. You put up $10,000 in capital to buy $20,000 of AMD stock, by borrowing $10,000 from your broker. Assuming AMD stock falls by 2% what dollar gain or loss...
-
What role does language diversity play in shaping cultural identities and communication patterns?
-
What is the present value of an investment that pays you $25.41 per month if the first payment is today and the last payment is in 6 months if the discount rate is 5.0% per month? (Round to the...
-
How do postcolonial perspectives contribute to discussions on diversity and decolonization efforts?
-
Consider a bond with a 10% coupon rate and a yield to maturity of 8%. What kind of bond is it? (Par, discount, premium). If the bonds yield to maturity remains constant, in one year will the bond...
-
QUESTION 6a) One of the benefits to the Market Approach is that the analyst can always find perfect matches of property sold in order to compare it to the property he/she is valuing. True False...
-
According during to the IRS, individuals filing federal income tax returns prior to March 31 received an average refund of $1,088 in 2018. Consider the population of "last-minute" filers who mail...
-
As in Exercise 24 and Example 36.10 assume that the height (in inches) of an American female is Normal with expected value = 64 and standard deviation 1 = 2.5. Also assume that the height of an...
-
According to past experience, 20% of customers coming into Frank's car dealership will buy one of his cars. Assume customers are independent and sampled from a very large population. Assume his...
-
A student makes a trip once per day to the store, and he always buys a snack. The student eats the snack 70% of the time, but the other 30% of the time, his roommate eats it first. a. During a period...
-
The expected effect on market efficiency of opening a securities market to trading by foreigners would be to: A. Decrease market efficiency. B. Leave market efficiency unchanged. C. Increase market...
-
Suppose that a speculative-grade bond issuer announces, just before bond markets open, that it will default on an upcoming interest payment. In the announcement, the issuer confirms various reports...
-
1. An analyst estimates that a securitys intrinsic value is lower than its market value. The security appears to be: A. Undervalued. B. Fairly valued. C. Overvalued. 2. A market in which assets...
Study smarter with the SolutionInn App