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

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()
expand button
[画像: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 !!
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
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