Menu

[Solved]Missing Second Part Word File C Code Following Include Include Using Namespace Std Enum S Q37206761

1) Regular Track (80 points) Write a C+ OOP program that simulates a vending machine. The program should define at least two

Create one word file (accounts for 20 points of the project credit). It should have following items. (10 points) At least 300

What its missing is the second part(Word file). My C++ code isthe following:

#include <iostream>

#include <map>

using namespace std;

enum stypes

{

GRAPES =1,

STRABERRY=2,

SPRITE= 3,

MANGO = 4,

BLACKBERRY =5

};

class VendingMachine

{

private:

int coinAmount;

map <int, int>sodaTypes;

map <int, int >itemsCount;

public:

VendingMachine();

void setCoinAmount(intamount);

double getCoinAmount();

map <int,int>getSodaTypes();

map <int,int>eachMaxItemsCount();

void showItems();

void displayErrorMessage(string);

~VendingMachine();

  

};

VendingMachine :: VendingMachine()

{

sodaTypes[1]=5;

sodaTypes[2]=6;

sodaTypes[3]=7;

sodaTypes[4]=6;

sodaTypes[5]=10;

itemsCount[1]=20;

itemsCount[2]=20;

itemsCount[3]=20;

itemsCount[4]=20;

itemsCount[5]=20;

coinAmount=0.0;

}

map <int,int>VendingMachine :: eachMaxItemsCount()

{

return itemsCount;

}

map <int,int>VendingMachine:: getSodaTypes()

{

return sodaTypes;

}

void VendingMachine :: showItems()

{

cout << ” Types of soda ” <<endl;

cout << ” 1. GRAPES ” <<endl;

cout << ” 2. STRABERRY ” <<endl;

cout << ” 3. SPRITE ” <<endl;

cout << ” 4. MANGO ” <<endl;

cout << ” 5. BLACKBERRY ” <<endl;

}

double VendingMachine :: getCoinAmount()

{

return coinAmount;

}

void VendingMachine ::setCoinAmount(int amount)

{

coinAmount += amount;

}

void VendingMachine ::displayErrorMessage(string msg)

{

cout << “Erro Message : “<<msg<<endl;

}

VendingMachine :: ~VendingMachine()

{

}

class Soda : publicVendingMachine

{

int item;

int price;

map <int,int >itemsCount;

map <int,int> types;

public:

Soda();

void displayCoinAmount();

bool enableQuater();

void selectionPad();

void addCoins();

voidstatusTransaction(bool);

};

Soda :: Soda()

{

}

void Soda :: addCoins()

{

cout << “n Please Add Coins : “;

cin >> price;

}

void Soda :: displayCoinAmount()

{

cout << “n Total Coin Amount : “<<getCoinAmount()<<endl;

}

void Soda ::statusTransaction(bool status)

{

if(status)

{

cout << “Soda is Dispached … !” <<endl;

  

if(item == 1)

{

cout << ” Taken Item : GRAPES Soda “<<endl;

  

}

else if(item == 2)

cout << ” Taken Item : STRABERRY Soda “<<endl;

else if(item == 3)

cout << ” Taken Item : SPRITE Soda “<<endl;

else if(item == 4)

cout << ” Taken Item : MANGO Soda “<<endl;

else if(item == 1)

cout << ” Taken Item : BLACKBERRY Soda “<<endl;

cout << “Balace Deposited amount : ” << price -types[item] <<endl;

cout << “Remain Items for Sale : ” <<endl;

cout << ” GRAPES Soda”<<itemsCount[1]<<endl;

cout << ” STRABERRY Soda”<<itemsCount[2]<<endl;

cout << ” SPRITE Soda”<<itemsCount[3]<<endl;

cout << ” MANGO Soda”<<itemsCount[4]<<endl;

cout << ” BLACKBERRY Soda”<<itemsCount[5]<<endl;

}

}

bool Soda :: enableQuater()

{

if(itemsCount[item] == 0)

return false;

–itemsCount[item];

setCoinAmount(price);

return true;

}

void Soda :: selectionPad()

{

types = getSodaTypes();

itemsCount= eachMaxItemsCount();

cout << GRAPES << “” <<types[2]<<endl;

addCoins();

cout << “nSelect Item which you need ” <<endl;

cin >> item;

bool status;

for(int i=1;i<6;i++)

{

if(i== item)

{

if(price < types[item] )

displayErrorMessage(“Insufficent coins inserted…”);

else if(itemsCount[item] ==0)

displayErrorMessage(“Item is Over…”);

else

{

status = enableQuater();

statusTransaction(status);

}

}

}

  

}

int main()

{

Soda obj;  

obj.showItems();

obj.selectionPad();  

return 0;

}

1) Regular Track (80 points) Write a C+ OOP program that simulates a vending machine. The program should define at least two classes. Less than two classes will result in 20 points deduction. (30 points) One must be general vending machine. (50 points) The other can be either vending machine of drink, vending machine of snack, vending machine of toys. It must be a subclass of above general machine. These vending machines should have following components and functions. Coin slot o Allow adding coins o Display total coin amount (in cents or dollars) o Minimum requirement: enable quarter dropping . Merchandise selection pad o One item each transaction o Minimum: five items for selection Main panel o Display the status of the transaction, such as balance of deposited fund, what have been purchased, what remain for sale, etc Display error messages. o Your program must utilizes at least two of following three syntactical elements: loop recursion function Missing anyone will cause deduction of 10 points. In addition, your program must implement following three major OOP features in C++ . Code separation (between definition and implementation) Missing of anyone will result in deduction of 15 points. The adoption of polymorphism (more specifically dynamic binding) is encouraged but not required. Create one word file (accounts for 20 points of the project credit). It should have following items. (10 points) At least 300 words of text Clear outline of input and output Clear description of algorithm and data structure Any submission less than 300 words will be proportionally penalized. o o o (10 points) A UML diagram that shows all classes involved and their components. Show transcribed image text 1) Regular Track (80 points) Write a C+ OOP program that simulates a vending machine. The program should define at least two classes. Less than two classes will result in 20 points deduction. (30 points) One must be general vending machine. (50 points) The other can be either vending machine of drink, vending machine of snack, vending machine of toys. It must be a subclass of above general machine. These vending machines should have following components and functions. Coin slot o Allow adding coins o Display total coin amount (in cents or dollars) o Minimum requirement: enable quarter dropping . Merchandise selection pad o One item each transaction o Minimum: five items for selection Main panel o Display the status of the transaction, such as balance of deposited fund, what have been purchased, what remain for sale, etc Display error messages. o Your program must utilizes at least two of following three syntactical elements: loop recursion function Missing anyone will cause deduction of 10 points. In addition, your program must implement following three major OOP features in C++ . Code separation (between definition and implementation) Missing of anyone will result in deduction of 15 points. The adoption of polymorphism (more specifically dynamic binding) is encouraged but not required.
Create one word file (accounts for 20 points of the project credit). It should have following items. (10 points) At least 300 words of text Clear outline of input and output Clear description of algorithm and data structure Any submission less than 300 words will be proportionally penalized. o o o (10 points) A UML diagram that shows all classes involved and their components.

Expert Answer


Answer to What its missing is the second part(Word file). My C++ code is the following: #include #include using namespace std; enu… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *