Computers and Technology

Write a program that simulates a vending machine. The machine holds six snack items labeled them 1 through 6. The program should initially display a menu of items along with their prices: Vending Machine 1. Roasted Almonds --> $1.25 2. Pretzels --> $1.75 3. Chewing Gum --> $0.90 4. Mints --> $0.75 5. Chocolate bar --> $1.50 6. Cookies --> $2.00 The program then should ask the user to enter the item to purchase along with a sum of money. If the money is enough to buy the item, your program should display the name of item purchased along with the change owed to the user (if any). If the money inserted is insufficient, then your program should say so and let the user know how much additional money is needed. Your program must display the money amounts using the dollar sign and two decimal places after the decimal point. Please note that your program must validate the input given by the user: The item to purchase an the amount of money are numeric values (e. g. int and float) If the user enters an invalid choice for an item to purchase, your program should alert the user of the error. The program should not accept negative values for the sum of money.

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 18:00, alexj29227405
Write a method named addall that could be placed inside the hashintset class. this method accepts another hashintset as a parameter and adds all elements from that set into the current set, if they are not already present. for example, if a set s1 contains [1, 2, 3] and another set s2 contains [1, 7, 3, 9], the call of s1.addall(s2); would change s1 to store [1, 2, 3, 7, 9] in some order. you are allowed to call methods on your set and/or the other set. do not modify the set passed in. this method should run in o(n) time where n is the number of elements in the parameter set passed in.
Answers: 2
image
Computers and Technology, 22.06.2019 19:20, SundaeSunday
Consider the following code snippet: #ifndef cashregister_h#define cashregister_hconst double max_balance = 6000000.0; class cashregister{public: cashregister(); cashregister(double new_balance); void set_balance(double new_balance); double get_balance() const; private: double balance[12]; }; double get_monthly_balance(cashregister bk, int month); #endifwhich of the following is correct? a)the header file is correct as given. b)the definition of max_balance should be removed since header files should not contain constants. c)the definition of cashregister should be removed since header files should not contain class definitions. d)the body of the get_monthly_balance function should be added to the header file.
Answers: 1
image
Computers and Technology, 22.06.2019 22:40, Bgreene2377
In this lab, you complete a python program that calculates an employee's annual bonus. input is an employee's first name, last name, salary, and numeric performance rating. if the rating is 1, 2, or 3, the bonus rate used is .25, .15, or .1 respectively. if the rating is 4 or higher, the rate is 0. the employee bonus is calculated by multiplying the bonus rate by the annual salary.
Answers: 1
image
Computers and Technology, 23.06.2019 19:30, carcon2019
Amitha writes up a one-page summary of a novel during her summer internship at a publishing company. when she reads over the page, she realizes she used the word “foreshadow” seven times, and she would like to reduce the repetition. which tool would best amitha solve this problem?
Answers: 3
Do you know the correct answer?
Write a program that simulates a vending machine. The machine holds six snack items labeled them 1 t...

Questions in other subjects:

Konu
Mathematics, 06.11.2020 20:10
Konu
Physics, 06.11.2020 20:10
Konu
English, 06.11.2020 20:10
Konu
History, 06.11.2020 20:10