Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Use the code provided below to write a complete C++ program that asks for the co

ID: 3534026 • Letter: U

Question

Use the code provided below to write a complete C++ program that asks for the code of an item in a vending machine and then prints the name and price of the item.Here is some sample code to get you going:

class Item {   

   public:    

     Item(string code, string name, float price);     

         // write the constructor code yourself    

         // write getCode, getName and getPrice functions

   private:

     string code;

     string name;

     float price;};

vector itemList;

Item notFound("00", "Not Found", 0.0);

Item findItem(string code){

   // loop through the items in the vector

   // and if found return the item

// otherwise   return notFound;}

void main(){

   Item smallDrink("A1", "Small Drink", .75);

   Item candyBar("B1", "Candy Bar", .50);  

   itemList.push_back(smallDrink);

   itemList.push_back(candyBar);

string code = "";

   cout << endl;

   cout << "Enter an item code:" ;

   cin >> code;

   Item item = findItem(code);

   cout << "You selected: " << item.getName() << endl;}

You will need to make the following changes:

Add a loop

Exit the loop if the user types in code 99. Program should output the following:

Exit code enter

Program Ending   

Run and check you code with Test 1 below

Add the additional items:

Item A2, Medium Drink, 1.00

Item A3, Large Drink, 1.25

Make your code print out the price of the item selected

Enter an item code: A1

You selected: Small Drink

The price is: 0.75

Run and test your code with Test 2 below

Add a variable to keep track of and print the number of items sold

Total items sold: 2

Add a variable to keep track of and print the total money made

Total money made: 1.25

Make your program's input and output look exactly like this:

Enter an item code: A1

   You selected: Small Drink

   The price is: 0.75

Enter an item code: B1

   You selected: Candy Bar

   The price is: 0.50

Enter an item code: C4

   Sorry item not found.

Enter an item code: 99

   Exit code entered.

   Program Ending

Total items sold: 2

Total money made: 1.25

Explanation / Answer

#include #include using namespace std; int main() { char money; double totalm = 0; double value = 0, valued = 0, valuen = 0, valueq = 0, valueb = 0; int c1=0, c2=0, c3=0, c4=0, c5=0, c6=0; int C1=0, C2=0, C3=0, C4=0, C5=0, C6=0; int item; cout