Write a program to simulate the operation of a soda vending machine. For simplic
ID: 3569185 • Letter: W
Question
Write a program to simulate the operation of a soda vending machine. For
simplicity, assume that the machine has only 3 kinds of products: SPRITE, FANTA, and WATER, each offered in either a can or bottle container (so 6 types in total).
Assume that we model each product with the following class:
class Product
{
public:
Product() // constructor
void setName(char name[]);
void setContainerType(int containerType);
void setUnitCost(float);
void setQuantity(unsigned int qty);
int getUnitCost(char name[], int containerType);
bool purchaseOne(char name[]);
int getQuantity()
private:
char name[20];
int containerType;
float unitCost;
float balance;
};
where
Explanation / Answer
#include<stdio.h>
Struct machine
{
Int select;
Int price;
Int pay;
Char display;
};
Int main()
{ struct machine drinks[6]={
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.