158k views
0 votes
IMobile is a mobile phone service company that offers three different data plans to its customers.

Plan A: Price: $39.99 per month.
Data allowance: Includes 4 gigabytes of data. Additional data costs $10 per gigabyte.
Plan B: Price: $59.99 per month.
Data Allowance: Includes 8 gigabytes of data. Additional data costs $5 per gigabyte.
Plan C: Price: $69.99 per month.
Data Allowance: Unlimited
Write a program that calculates a customer's monthly bill. It should prompt the user for the customer's plan and the number of gigabytes of data used. It should then calculate and display the total amount due.

User Tanzania
by
7.4k points

1 Answer

4 votes

Final answer:

To calculate the total amount due for iMobile data plans, you need to consider the plan and the amount of data used. Plan A has a base price of $39.99 with additional data cost of $10 per gigabyte. Plan B has a base price of $59.99 with additional data cost of $5 per gigabyte. Plan C has a fixed price of $69.99. Validate user input and calculate accordingly.

Step-by-step explanation:

To calculate the total amount due, you need to check which plan the customer is on and how much additional data they have used. Let's break it down:



Plan A:

If the customer is on Plan A, you need to check if they have used more than 4 gigabytes of data. If they have used more, you need to calculate the additional cost by multiplying the excess data by $10. Finally, you add the extra cost to the base price of $39.99 to get the total amount due.



Plan B:

For customers on Plan B, the process is similar. If they have used more than 8 gigabytes of data, you multiply the excess data by $5 and add it to the base price of $59.99.



Plan C:

In the case of Plan C, there is no limit to the data usage. Therefore, the customer will only pay the fixed price of $69.99 per month.



Remember to handle user input correctly and validate the values provided to ensure accurate calculations.

User Machump
by
8.2k points