Write a program to calculate and print out cellular phone bills for one month, and write a test plan to test the program.
The rates will vary depending on the calling plan of the customer:
Fixed rate plan (code F),
per Minute charge plan (code M),
Home customer plan (code H),
home Plus customer plan (code P), or
Business customer plan (code B).
The rates are as follows:
No other codes should be accepted. Remember to define constants for all fixed values. Use double precision floating point variables for all dollar & cents figures.
The program should first explain the program to the user.
Then prompt for a 5-digit customer account number (no leading zeros allowed) and error check that the value entered is valid. Re-prompt until a valid value is entered. This input should be read and error checked from within the main function.
Next call display a menu of plan codes, along with descriptions of each, to the user. Prompt for the plan code and error check that the user entered a valid plan code (accepted in upper or lowercase). Re-prompt until a valid value is entered.
If necessary (all plans except plan F), also prompt for the number of minutes used and error check that the number entered is not negative (i.e. must be at least 0). Minutes used will always be whole numbers. Re-prompt until a valid value is entered.
Calculate the bill total and display the results.
The output should display: the customer account number, the plan chosen in words, the number of minutes used (unless the plan chosen was F), and the total amount of the bill. Display neatly with descriptive text.
After displaying the results, ask the user whether to execute the program again, and do so, as long as the user wishes to continue.
At a minimum, the program must implement three separate functions (in addition to main), as described on the next page:
Use of global variables is NOT allowed. The functions must use parameters to pass required data to each function. Remember to pass all input only parameters by value, and pass all output parameters by reference.
As part of your submission for this week, you must write a test plan for this program (program 1). First list the rationale for creating your test cases. Then create each test case. Your test cases should include all INPUTs you used for the test and what OUTPUT you expected. Submit your test plan as an MS Word document or an MS Excel spreadsheet.
Write a program to compare the return from a yearly compounded interest calculation (i.e. figured and added to the balance annually) to interest that is compounded monthly, weekly, or daily.
The program should:
In addition to main, your program must contain a minimum of four additional functions with parameters and/or return values. You should try to use functions to reduce code duplication, when the code is similar in multiple places.
HINT: When you consider how to break this program into functions, think about how program 1 was divided up:
Use of global variables is NOT allowed. The functions should use parameters to pass required data to each function. Remember to pass all input parameters by VALUE, and pass all output parameters by REFERENCE.
Display dollar figures to 2 decimal places and the interest rate to 3 decimal places.
Sample Run
This program demonstrates the benefits of compounding interest.
Compare Annual Compounding to:
M - Monthly Compounding
W - Weekly Compounding
D - Daily Compounding
E - Exit Program
Enter choice from Menu above: w
Enter your beginning balance: 5555.55
Enter an annual interest rate: 5.5
Enter a term in whole years: 5
------------------------------------------------
RESULTS
------------------------------------------------
Beginning Balance: 5555.55
Return after 5 years at 5.500% interest annually:
Return Ending Balance
Compounded Yearly: $ 1705.33 $ 7260.88
Compounded Weekly: $ 1757.44 $ 7312.99
------------------------------------------------
Press any key to continue . . .
When the user presses a key to continue, the program will loop and re-display the menu. The program will exit when the user chooses EXIT from the menu.