Having a bit of trouble getting this to show up right on the output. Let me know what you come up with.
To me it was a bit challenging and I still cannot get the billing information to come up.. Looking forward to seeing what you guys come up with!
This programming example calculates a customer’s bill for a local cable company
There are two types of customers:
Residential
Business
Two rates for calculating a cable bill:
One for residential customers
One for business customers
For residential customer:
Bill processing fee: $4.50
Basic service fee: $20.50
Premium channel: $7.50 per channel
For business customer:
Bill processing fee: $15.00
Basic service fee: $75.00 for first 10 connections and $5.00 for each additional connection
Premium channel cost: $50.00 per channel for any number of connections
Assume R or r stands for residential customer and B or b stands for business customer
Input:
Customer account number
Customer code
Number of premium channels
For business customers, number of basic service connections
Output:
Customer’s account number
Billing amount
Purpose: calculate and print billing amount
Calculating billing amount requires:
Customer for whom the billing amount is calculated (residential or business)
Number of premium channels to which the customer subscribes
For a business customer, you need:
Number of basic service connections
Number of premium channels
Data needed to calculate the bill, such as bill processing fees and the cost of a premium channel, are known quantities
The program should print the billing amount to two decimal places
Set precision to two decimal places
Prompt user for account number and customer type
If customer type is R or r
Prompt user for number of premium channels
Compute and print the bill
If customer type is B or b
Prompt user for number of basic service connections and number of premium channels
Compute and print the bill
[IMG]
http://i198.photobucket.com/albums/aa308/tristascorner/Picture2.png[/IMG]
[IMG]
http://i198.photobucket.com/albums/aa308/tristascorner/Picture1.png[/IMG]
Formulas to use:
Billing for residential customers:
amountDue = RES_BILL_PROC_FEES +
RES_BASIC_SERV_COST
+ numOfPremChannels *
RES_COST_PREM_CHANNEL;
Billing for business customers:
if (numOfBasicServConn <= 10)
amountDue = BUS_BILL_PROC_FEES +
BUS_BASIC_SERV_COST
+ numOfPremChannels *
BUS_COST_PREM_CHANNEL;
else
amountDue = BUS_BILL_PROC_FEES +
BUS_BASIC_SERV_COST
+ (numOfBasicServConn - 10)
* BUS_BASIC_CONN_COST
+ numOfPremChannels *
BUS_COST_PREM_CHANNEL;
Output floating-point numbers in fixed decimal with decimal point and trailing zeros
Output floating-point numbers with two decimal places and set the precision to two decimal places
Prompt user to enter account number
Get customer account number
Prompt user to enter customer code
Get customer code
If the customer code is r or R,
Prompt user to enter number of premium channels
Get the number of premium channels
Calculate the billing amount
Print account number and billing amount
If customer code is b or B,
Prompt user to enter number of basic service connections
Get number of basic service connections
Prompt user to enter number of premium channels
Get number of premium channels
Calculate billing amount
Print account number and billing amount
If customer code is other than r, R, b, or B, output an error message