Exercise 1 – Phone Bills
A particular cell phone plan includes 500 minutes of air time and 500 text messages for $15.00 a month. Each additional minute of air time costs $0.25, while additional text messages cost $0.15 each. All cell phone bills include an additional charge of $0.44 to support 911 call centers, and the entire bill (including the 911 charge) is subject to 5 percent sales tax.
Write the code in C and draw a flowchart that reads as input the number of minutes and text messages used in a month by the user and then displays the base charge, additional minutes charge (if any), additional text message charge (if any), the 911 fee, the tax and the total bill amount. Only display the additional minute and text message charges if the user incurred costs in these categories. Ensure that all of the charges are displayed using 2 decimal places. Explain the calculations by example.
A sample execution of this program may be:
This program will calculate your monthly phone bill.
Enter the minutes: 546
Enter the text messages: 425
Base charge: $15.00
Additional minutes charge: $11.50
The 911 fee: $0.44
Tax: $1.34
Total amount: $28.28