#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 << "Enter coffee add-in or XXX to quit: "; cin >> addIn; // Write the rest of the program here. return 0; } // End of main()
#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 << "Enter coffee add-in or XXX to quit: "; cin >> addIn; // Write the rest of the program here. return 0; } // End of main()
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Concept explainers
Max Function
Statistical function is of many categories. One of them is a MAX function. The MAX function returns the largest value from the list of arguments passed to it. MAX function always ignores the empty cells when performing the calculation.
Power Function
A power function is a type of single-term function. Its definition states that it is a variable containing a base value raised to a constant value acting as an exponent. This variable may also have a coefficient. For instance, the area of a circle can be given as:
Question
// 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()
![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](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F4bfbb203-4399-4804-a6b8-bbfebafe4401%2F145b10d7-ac08-46b7-848c-c38e56c4a409%2Fnnbm8i_processed.jpeg&w=3840&q=75)
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
![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
!!](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F4bfbb203-4399-4804-a6b8-bbfebafe4401%2F145b10d7-ac08-46b7-848c-c38e56c4a409%2Fsuztw3d_processed.jpeg&w=3840&q=75)
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
!!
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
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.Recommended textbooks for you
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education