Question
Problem: Youve been asked by a cell phone service provider to write a program that will calculate the amount of the data portion of a
Problem: Youve been asked by a cell phone service provider to write a program that will calculate the amount of the data portion of a customers monthly bill. Write a C++ program that will calculate the amount of the bill given which data plan the customer subscribes to and how many gigabytes of data they used during the month.
The cellular service provider offers the following data plans:
Package A: 1 gigabyte for $10/month.
Package B: 5 gigabytes for $25/month.
Package C: 10 gigabytes for $40/month. $5 for each extra GB used
Note: If the user goes over their plans limit of data during the month, they will be automatically upgraded to a plan that covers the amount that they used (and be charged the new plans rate). If a user goes over the 10 gigabyte limit for Package C, they are charged an additional $5.00 for each extra gigabyte used.
Input: Use the following menu to prompt the user for the customers data plan:
Data Plans:
The 1 gigabyte plan ($10)
The 5 gigabytes plan ($25)
The 10 gigabyte plan ($40+)
Enter which data plan the customer subscribes to:
Then the program should ask the user to input the number of gigabytes used in the month. This value could have fractional amounts included (like 2.875).
For both inputs, use an if statement to perform input validation. The user should select only A,B, or C from the menu, and the gigabytes should be greater than or equal to 0. If either input is valid, the program should exit with an appropriate error message.
Processing: Compute the amount of the monthly bill according to the plan descriptions above.
Additionally, if the customer was on plan A or B and was automatically moved to plan B or C, output a message indicating this fact.
Output: Display the amount of the monthly bill with a dollar sign and formatted to 2 decimal places. If the customer was moved to another plan, output a message (this message may comes before or after the amount). Here are 5 different sample executions of the program:
Data Plans:
The 1 gigabyte plan ($10)
The 5 gigabytes plan ($25)
The 10 gigabyte plan ($40+)
Enter which data plan the customer subscribes to: A
Enter the amount of data used during the month, in gigabytes: 0.75
The amount due for the month is $10.00
Data Plans:
The 1 gigabyte plan ($10)
The 5 gigabytes plan ($25)
The 10 gigabyte plan ($40+)
Enter which data plan the customer subscribes to: A
Enter the amount of data used during the month, in gigabytes: 6
You have been switched to plan C
The amount due for this month is $40.00
Data Plans:
The 1 gigabyte plan ($10)
The 5 gigabytes plan ($25)
The 10 gigabyte plan ($40+)
Enter which data plan the customer subscribes to: B
Enter the amount of data used during the month, in gigabytes: 3.75
The amount due for the month is $25.00
Data Plans:
The 1 gigabyte plan ($10)
The 5 gigabytes plan ($25)
The 10 gigabyte plan ($40+)
Enter which data plan the customer subscribes to: C
Enter the amount of data used during the month, in gigabytes: 4.2
The amount due for the month is $40.00
Data Plans:
The 1 gigabyte plan ($10)
The 5 gigabytes plan ($25)
The 10 gigabyte plan ($40+)
Enter which data plan the customer subscribes to: B
Enter the amount of data used during the month, in gigabytes: 10.5
You have been switched to plan C
The amount due for the month is $42.50
Additional Requirements:
Do NOT use ANY LOOPS! The program should compile one bill only.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started