Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

Question
100%
// 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 <iostream>
#include <string>
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 << "Enter coffee add-in or XXX to quit: ";
   cin >> addIn;
    
   // Write the rest of the program here. 
   return 0;
} // End of main() 
Parallel Arrays
JumpinJive.cpp
Co a n you wilele to wite your ɔlateiiemLS.
1 // JumpinJava.cpp
21/ Input:
3 // Output: Name and price of coffee orders or error message if add-in is no
This program looks up and prints the names and prices a
dy Tools
Interactive
Instructions
4.
5 #include <iostream>
1. Study the prewritten code to make sure you
6 #include <string>
understand it.
7 using namespace std;
5 Tips
8.
2. Write the code that searches the array for the name
9 int mainO
Tips
of the add-in ordered by the customer.
10 {
11
// Declare variables.
3. Write the code that prints the name and price of the
12
string addIn;
const int NUM ITEMS = 5; // Named constant
no.
W Add-in ordered
add-in or the error message, and then write the
13
code that prints the cost of the total order.
14
// Initialized array of add-ins
string addIns[]
V/ Initialized array of add-in prices
15
{"Cream", "Cinnamon", "Chocolate", "Amaretto", "Whiskey"};
4. Execute the program by clicking the Run button at
16
17
double addInPrices[]
bool foundIt = false;
the bottom of the screen. Use the following data:
= {,89, .25, .59, 1.50, 1.75};
18
// Flag variable
// Loop control variable
boxes
Cream
19
int X;
20
double orderTotal
2.00; // All orders start with a 2.00 charge
21
Caramel
22
// Get user input
Whiskey
23
cout << "Enter coffee add-in or XXX to quit: ";
ck
24
cin >> addIn;
chocolate
25
26
// Write the rest of the program here.
Chocolate
27
return O;
28 }// End of main()
Cinnamon
29
Vanilla
!!
expand button
Transcribed Image Text:Parallel Arrays JumpinJive.cpp Co a n you wilele to wite your ɔlateiiemLS. 1 // JumpinJava.cpp 21/ Input: 3 // Output: Name and price of coffee orders or error message if add-in is no This program looks up and prints the names and prices a dy Tools Interactive Instructions 4. 5 #include <iostream> 1. Study the prewritten code to make sure you 6 #include <string> understand it. 7 using namespace std; 5 Tips 8. 2. Write the code that searches the array for the name 9 int mainO Tips of the add-in ordered by the customer. 10 { 11 // Declare variables. 3. Write the code that prints the name and price of the 12 string addIn; const int NUM ITEMS = 5; // Named constant no. W Add-in ordered add-in or the error message, and then write the 13 code that prints the cost of the total order. 14 // Initialized array of add-ins string addIns[] V/ Initialized array of add-in prices 15 {"Cream", "Cinnamon", "Chocolate", "Amaretto", "Whiskey"}; 4. Execute the program by clicking the Run button at 16 17 double addInPrices[] bool foundIt = false; the bottom of the screen. Use the following data: = {,89, .25, .59, 1.50, 1.75}; 18 // Flag variable // Loop control variable boxes Cream 19 int X; 20 double orderTotal 2.00; // All orders start with a 2.00 charge 21 Caramel 22 // Get user input Whiskey 23 cout << "Enter coffee add-in or XXX to quit: "; ck 24 cin >> addIn; chocolate 25 26 // Write the rest of the program here. Chocolate 27 return O; 28 }// End of main() Cinnamon 29 Vanilla !!
ays
JumpinJive.cpP
1 // JumpinJava.cpp - This program looks up and prints the n
Summary
2 // Input:
Interactive
3//Output: Name and price of coffee orders or error messag
4.
In this lab, you use what you have learned about parallel
5. #include <iostream>
</>
arrays to complete a partially completed C++ program.
6 #include <string>
The program should:
7 using namespace std;
8)
• Either print the name and price for a coffee add-in
9 int main()
10 {
from the Jumpin' Jive Coffee Shop
|11
/ Declare variables
• Or it should print the message
12
string addIn;
/ Add-in ordered
13
const int NUM ITEMS
5; // Named constant
Sorry, we do not carry that.
14
WInitialized array of add-ins
string addIns[]
//Initiaized array of add-in prices
15
{"Cream", "Cinnamon", "Chocolate", "Amar
Read the problem description carefully before you
16
17
double addInPrices[]
{.89, .25, . 59, 1.50, 1.75};
/ Flag variable
begin. The file provided for this lab includes the
18
bool foundIt = false;
necessary variable declarations and input statements.
19
int x
//Loop control variable
double orderTotal = 2.00; // All orders start with a 2.00 ch
You need to write the part of the program that searches
20
21
22
for the name of the coffee add-in(s) and either prints
the name and price of the add-in or prints the error
// Get user input
23
cout << "Enter coffee add-in or XXX to quit:
message if the add-in is not found. Comments in the
24
cin >> addIn;
code tell you where to write your statements.
25
26
7/ Write the rest of the program here
expand button
Transcribed Image Text:ays JumpinJive.cpP 1 // JumpinJava.cpp - This program looks up and prints the n Summary 2 // Input: Interactive 3//Output: Name and price of coffee orders or error messag 4. In this lab, you use what you have learned about parallel 5. #include <iostream> </> arrays to complete a partially completed C++ program. 6 #include <string> The program should: 7 using namespace std; 8) • Either print the name and price for a coffee add-in 9 int main() 10 { from the Jumpin' Jive Coffee Shop |11 / Declare variables • Or it should print the message 12 string addIn; / Add-in ordered 13 const int NUM ITEMS 5; // Named constant Sorry, we do not carry that. 14 WInitialized array of add-ins string addIns[] //Initiaized array of add-in prices 15 {"Cream", "Cinnamon", "Chocolate", "Amar Read the problem description carefully before you 16 17 double addInPrices[] {.89, .25, . 59, 1.50, 1.75}; / Flag variable begin. The file provided for this lab includes the 18 bool foundIt = false; necessary variable declarations and input statements. 19 int x //Loop control variable double orderTotal = 2.00; // All orders start with a 2.00 ch You need to write the part of the program that searches 20 21 22 for the name of the coffee add-in(s) and either prints the name and price of the add-in or prints the error // Get user input 23 cout << "Enter coffee add-in or XXX to quit: message if the add-in is not found. Comments in the 24 cin >> addIn; code tell you where to write your statements. 25 26 7/ Write the rest of the program here
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education