Assume you're writing this menu-driven program for a swimming pool service company. There are three levels of customers: occasional, monthly, and yearly. There are two types of service: normal and deluxe a. As shown in Program 4-18, please declare constants for the levels of customers. Most C++ programmers write the names of constants in ALL CAPS; please do likewise in this program. b. Show the menu in a clear form, and prompt the user for the customer level; the rest of the program depends on the customer level chosen. c. 1. For occasional customers, ask for the type of service and the company cost (double) involved. If the service type is normal, then the price for the customer is 1.8 times the company cost. For deluxe service, the price for the customer is 2.5 times the company cost. 2. For monthly customers, ask for the type of service, and the company cost (double) involved. If the service type is normal, then the price for the customer is 1.5 times the company cost. For deluxe service, the price for the customer is 2 times the company cost. 3. For yearly customers, ask for the type of service and the company cost involved. If the service type is normal, then the price for the customer is 1.25 times the company cost. For deluxe service, the price for the customer is 1.5 times the company cost. For yearly customers, there is a 10% discount. 4. Please verify the user input each time the user enters a value. If the input is incorrect, set a flag to indicate that condition. You'll need the flag when you display output. d. Output. Here are several scenarios. The customer is an occasional one, service type is normal, and company cost is $137.68. The output should look like: Ex1: : Occasional : Normal Price to Customer : $247.82 Customer level Service type The customer is a yearly one, service type is deluxe, and company cost is $298.16. The output should look like: Ex2: : Yearly : Deluxe Customer level Service type Discount : 10% Price to Customer : $402.52 Ex3: The input is invalid for at least one of the prompts. The only output should be: There was invalid input. Please try again.

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
icon
Related questions
Question

Please, I need to answer this question using the C++ programming language and Visual Studio. Thank you.

 

Program 4-18 

// This program displays a menu and asks the user to make a

// selection. An if/else if statement determines which item

// the user has chosen.

#include <iostream>

#include <iomanip>

using namespace std;

 

int main()

{

int choice;     // To hold a menu choice

int months;     // To hold the number of months

double charges; // To hold the monthly charges

 

// Constants for membership rates

const double ADULT = 40.0,

             SENIOR = 30.0,

             CHILD = 20.0;

 

// Constants for menu choices

const int ADULT_CHOICE = 1,

          CHILD_CHOICE = 2,

          SENIOR_CHOICE = 3,

          QUIT_CHOICE = 4;

 

// Display the menu and get a choice.

cout << "\t\tHealth Club Membership Menu\n\n"

     << "1. Standard Adult Membership\n"

     << "2. Child Membership\n"

     << "3. Senior Citizen Membership\n"

     << "4. Quit the Program\n\n"

     << "Enter your choice: ";

cin >> choice;

 

// Set the numeric output formatting.

cout << fixed << showpoint << setprecision(2);

 

// Respond to the user's menu selection.

if (choice == ADULT_CHOICE)

{

   cout << "For how many months? ";

   cin >> months;

   charges = months * ADULT;

   cout << "The total charges are $" << charges << endl;

}

else if (choice == CHILD_CHOICE)

{

   cout << "For how many months? ";

   cin >> months;

   charges = months * CHILD;

   cout << "The total charges are $" << charges << endl;

}

else if (choice == SENIOR_CHOICE)

{

    cout << "For how many months? ";

    cin >> months;

    charges = months * SENIOR;

    cout << "The total charges are $" << charges << endl;

}

else if (choice == QUIT_CHOICE)

{

    cout << "Program ending.\n";

}

else

{

    cout << "The valid choices are 1 through 4. Run the\n"

         << "program again and select one of those.\n";

}

return 0;

}

Assume you're writing this menu-driven program for a swimming pool service company.
There are three levels of customers: occasional, monthly, and yearly.
There are two types of service: normal and deluxe
a. As shown in Program 4-18, please declare constants for the levels of customers. Most C++
programmers write the names of constants in ALL CAPS; please do likewise in this program.
b. Show the menu in a clear form, and prompt the user for the customer level; the rest of the program
depends on the customer level chosen.
c. 1. For occasional customers, ask for the type of service and the company cost (double) involved. If
the service type is normal, then the price for the customer is 1.8 times the company cost. For
deluxe service, the price for the customer is 2.5 times the company cost.
2. For monthly customers, ask for the type of service, and the company cost (double) involved. If the
service type is normal, then the price for the customer is 1.5 times the company cost. For deluxe
service, the price for the customer is 2 times the company cost.
3. For yearly customers, ask for the type of service and the company cost involved. If the service
type is normal, then the price for the customer is 1.25 times the company cost. For deluxe
service, the price for the customer is 1.5 times the company cost. For yearly customers, there is a
10% discount.
4. Please verify the user input each time the user enters a value. If the input is incorrect, set a flag
to indicate that condition. You'll need the flag when you display output.
d. Output. Here are several scenarios.
The customer is an occasional one, service type is normal, and company cost is $137.68.
The output should look like:
Ex1:
: Occasional
: Normal
Price to Customer : $247.82
Customer level
Service type
The customer is a yearly one, service type is deluxe, and company cost is $298.16.
The output should look like:
Ex2:
: Yearly
: Deluxe
Customer level
Service type
Discount
: 10%
Price to Customer : $402.52
Ex3:
The input is invalid for at least one of the prompts. The only output should be:
There was invalid input. Please try again.
Transcribed Image Text:Assume you're writing this menu-driven program for a swimming pool service company. There are three levels of customers: occasional, monthly, and yearly. There are two types of service: normal and deluxe a. As shown in Program 4-18, please declare constants for the levels of customers. Most C++ programmers write the names of constants in ALL CAPS; please do likewise in this program. b. Show the menu in a clear form, and prompt the user for the customer level; the rest of the program depends on the customer level chosen. c. 1. For occasional customers, ask for the type of service and the company cost (double) involved. If the service type is normal, then the price for the customer is 1.8 times the company cost. For deluxe service, the price for the customer is 2.5 times the company cost. 2. For monthly customers, ask for the type of service, and the company cost (double) involved. If the service type is normal, then the price for the customer is 1.5 times the company cost. For deluxe service, the price for the customer is 2 times the company cost. 3. For yearly customers, ask for the type of service and the company cost involved. If the service type is normal, then the price for the customer is 1.25 times the company cost. For deluxe service, the price for the customer is 1.5 times the company cost. For yearly customers, there is a 10% discount. 4. Please verify the user input each time the user enters a value. If the input is incorrect, set a flag to indicate that condition. You'll need the flag when you display output. d. Output. Here are several scenarios. The customer is an occasional one, service type is normal, and company cost is $137.68. The output should look like: Ex1: : Occasional : Normal Price to Customer : $247.82 Customer level Service type The customer is a yearly one, service type is deluxe, and company cost is $298.16. The output should look like: Ex2: : Yearly : Deluxe Customer level Service type Discount : 10% Price to Customer : $402.52 Ex3: The input is invalid for at least one of the prompts. The only output should be: There was invalid input. Please try again.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Introduction to Coding
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
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education