It wont display the order total // JumpinJava.cpp - This program looks up and prints the names and prices of coffee orders. // Input: Interactive // Output:...



It wont display the order total


// JumpinJava.cpp - This program looks up and prints the names and prices of coffee orders.

// Input:  Interactive

// Output:  Name and price of coffee orders or error message if add-in is not found



#include 

#include 

using namespace std;



int main()

{

   // Declare variables.

   string addIn;     // Add-in ordered

   const int NUM_ITEMS = 5; // Named constant

   // Initialized array of add-ins

   string addIns[] = {"Cream", "Cinnamon", "Chocolate", "Amaretto", "Whiskey"};

   // Initialized array of add-in prices

   double addInPrices[] = {.89, .25, .59, 1.50, 1.75};

   bool foundIt = false;     // Flag variable

   int x;            // Loop control variable

   double orderTotal = 2.00; // All orders start with a 2.00 charge



   // Get user input

   cout <>

   cin >> addIn;


   // Write the rest of the program here.

   while(addIn != "XXX") //loop until user enters XXX

   {

     bool foundIt = false; //before searching intializes found it as False

     x = 0;

     while (x < num_items) { >

     if (addIn == addIns[x]) {

       foundIt = true; //if match is found

       orderTotal = orderTotal + addInPrices[x]; //add price of the item to the total

  cout <><><><><>< endl; >

     }

     x++;

  }

     if(!foundIt){ //if item not found

     cout <><>

     }

     cout <><>

     cin >> addIn;

   }

   cout <><>< endl; >

   cout <><>

   return 0;

} // End of main()


Checks<br>Test Case • Incomplete<br>Test for valid flavors<br>Input<br>Cream<br>Whiskey<br>XXX<br>Output<br>Enter coffee add-in or XXX to quit: Cream<br>The price of Cream is 0.89.<br>Enter coffee add-in or XXX to quit:<br>Whiskey<br>The price of Whiskey is 1.75.<br>Enter coffee add-in or XXX to quit:<br>XXX<br>Order total: 4.64<br>Вye!<br>Results<br>.89 |1.75 Order Total is $4.64<br>Show Details<br>><br>

Extracted text: Checks Test Case • Incomplete Test for valid flavors Input Cream Whiskey XXX Output Enter coffee add-in or XXX to quit: Cream The price of Cream is 0.89. Enter coffee add-in or XXX to quit: Whiskey The price of Whiskey is 1.75. Enter coffee add-in or XXX to quit: XXX Order total: 4.64 Вye! Results .89 |1.75 Order Total is $4.64 Show Details >
Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here