Please answer using pseudocode. Aka answers in english. Please dont use any spec
ID: 3770957 • Letter: P
Question
Please answer using pseudocode. Aka answers in english. Please dont use any specific code language as I am in an introductory logic class. The Vending Machine problem! The program should do the following operations: 1. Take as input an item number and money (The program terminates when a user enters a negative money amount and “000” as an item number.) 2. Check to see if the item exists. (if it doesn’t give the user a chance to re-enter the number) 3. Check to see if the money is sufficient enough to pay for item. (If not request more money) 4. Check to see if item is in stock. (If not user should be notified with the choice of selecting new item or cancelling the order) 5. If the item is in stock and the money is sufficient, the program should provide change and update the money reservoir and product inventory. 6. When the dispensing change, the program must insure that it always returns the correct amount of change based on the coins available in the reservoir. For example, if a user is owed $0.30 then the program may return 1 quarter and 1 nickel. However, if there are no quarters, the program should be smart enough to return a different combination of that doesn’t include quarters. (If no combination of change exists, the user’s order should be cancelled and the user should be allowed to make an alternate selection) 7. Once a transaction is complete, the user should be prompted to make a new selection. The program will end when a user enters a negative money amount and “000” for the item number. Product Inventory: Below is a breakdown of the products offered by the vending machine. In addition to the product names, the prices, item number and quantities are also listed below. The user will use the item number to select the product they wish to purchase. Product Name Item Number Price Quantity in Stock Candy Bar 123 $0.60 60 Gum 124 $0.35 75
Explanation / Answer
we will create the following functions in c++ to perform the following:
pseudocode: create a class perform
class perform {private: declare
char Product Name[10];
int Item Number[10]
int money[10];
int Quantity[10];
funtions:
1.input()
{ to take the itemnumber and money from the user"}
2.check()-to see if the item exists or net
{ compare the item number entered using a for loop with the array of itemnumbers,if the match is found=>item exists otherwise it does not exist}
3.check_money_is sufficient()
{ here we compare the money entered by user with the item cost. if money>item cost ,money is sufficient otherwise not}
4.check_item _in stock()
{ enter the item number and name and compare it with the array of item number and name. If a match is found display it exists otherwise enter a new item number name}
if item is in stock=>itemnumber=itemnumberr[i](match found)
change=money-itemcost
balance in the reservoir=change;
return change to the person in quarters
if (no quarters)
{ return in different combination
}
}=class ends
Main()
{perform p1;->object created
calling functions:
for (int i=0;i<10;i++) [ for 10 users)]
{ p1.input();
p1.check();
p1.check_money_is_suffcient();
p1.check_item_in_stock();
}