Java Reference
In-Depth Information
10 , you must add the cost for each connection over 10 . The following statement
calculates the business billing amount:
if (noOfBasicServConn <= 10)
amountDue =
B_BILL_PROC_FEE + B_BASIC_SERV_COST +
noOfPremChannels * B_COST_PREM_CHANNEL;
else
amountDue =
B_BILL_PROC_FEE + B_BASIC_SERV_COST +
(noOfBasicServConn - 10) *
B_BASIC_CONN_COST +
noOfPremChannels * B_COST_PREM_CHANNEL;
Based on the preceding discussion, you can now write the main algorithm.
1. Prompt the user to enter the account number.
2. Get the customer account number.
3. Prompt the user to enter the customer code.
4. Get the customer code.
5. If the customer code is r or R :
a. Prompt the user to enter the number of premium channels.
b. Get the number of premium channels.
c. Calculate the billing amount.
d. Print the account number.
e. Print the billing amount.
6. If the customer code is b or B :
a. Prompt the user to enter the number of basic service connections.
b. Get the number of basic service connections.
c. Prompt the user to enter the number of premium channels.
d. Get the number of premium channels.
e. Calculate the billing amount.
f. Print the account number.
g. Print the billing amount.
7. If the customer code is something other than r , R , b ,or B , output an
error message.
For Steps 5 and 6, the program uses a switch statement to calculate the bill for the
desired customer. (You can also use an if ... else statement to implement Steps 5
and 6.)
MAIN
ALGORITHM
 
Search WWH ::




Custom Search