// MichiganCities.cpp - This program prints a message for invalid cities in Michigan. // Input: Interactive // Output: Error message or nothing #include #include using namespace std; int main() { // Declare variables string inCity; // name of city to look up in array const int NUM_CITIES = 10; // Initialized array of cities string citiesInMichigan[] = {"Acme", "Albion", "Detroit", "Watervliet", "Coloma", "Saginaw", "Richland", "Glenn", "Midland", "Brooklyn"}; bool foundIt = false; // Flag variable int x; // Loop control variable // Get user input cout << "Enter name of city: "; cin >> inCity; // Write your loop here // Write your test statement here to see if there is // a match. Set the flag to true if city is found. // Test to see if city was not found to determine if // "Not a city in Michigan" message should be printed. return 0; } // End of main()
// MichiganCities.cpp - This program prints a message for invalid cities in Michigan. // Input: Interactive // Output: Error message or nothing #include #include using namespace std; int main() { // Declare variables string inCity; // name of city to look up in array const int NUM_CITIES = 10; // Initialized array of cities string citiesInMichigan[] = {"Acme", "Albion", "Detroit", "Watervliet", "Coloma", "Saginaw", "Richland", "Glenn", "Midland", "Brooklyn"}; bool foundIt = false; // Flag variable int x; // Loop control variable // Get user input cout << "Enter name of city: "; cin >> inCity; // Write your loop here // Write your test statement here to see if there is // a match. Set the flag to true if city is found. // Test to see if city was not found to determine if // "Not a city in Michigan" message should be printed. 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
Question
// MichiganCities.cpp - This program prints a message for invalid cities in Michigan.
// Input: Interactive
// Output: Error message or nothing
#include <iostream>
#include <string>
using namespace std;
int main()
{
// Declare variables
string inCity; // name of city to look up in array
const int NUM_CITIES = 10;
// Initialized array of cities
string citiesInMichigan[] = {"Acme", "Albion", "Detroit", "Watervliet", "Coloma", "Saginaw", "Richland", "Glenn", "Midland", "Brooklyn"};
bool foundIt = false; // Flag variable
int x; // Loop control variable
// Get user input
cout << "Enter name of city: ";
cin >> inCity;
// Write your loop here
// Write your test statement here to see if there is
// a match. Set the flag to true if city is found.
// Test to see if city was not found to determine if
// "Not a city in Michigan" message should be printed.
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
!!](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F4bfbb203-4399-4804-a6b8-bbfebafe4401%2F6d59af12-b2b2-4900-b02f-27b4c4af3bed%2Fwp8ys9a_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

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 with 4 images

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
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education