Question: An Internet Service Provider ( ISP ) has three different subscription packages for its customers: Package A: For $ 1 5 per month with 5

An Internet Service Provider(ISP) has three different subscription packages for its customers:
Package A: For $15 per month with 50 hours of access provided.
Additional hours are $2.00 per hour over 50 hours.
Package B: For $20 per month with 100 hours of access provided.
Additional hours are $1.50 per hour over 100 hours.
Package C: For $25 per month with 150 hours access is provided.
Additional hours are $1.00 per hour over 150 hours
The ISP has contracted us to write the application software for their new Billing System.
Assume the Billing Cycle is 30 days.
Assume usage is recorded in one-hour increments,
Write a program that uses the following functions to obtain the number of hours consumed, and calculates the different amounts owed based on the plan type:
unsigned short getHours();
float calculatePkgA(unsigned short hours);
float calculatePkgB(unsigned short hours);
float calculatePkgC(unsigned short hours);
Sample output:
Enter the # of hours of access used:135
Under plan A your cost is: $185.00
Under plan B your cost is: $72.50
Under plan C your cost is: $25.00
Bonus:
write a function with this signature:
float calculatePacakge(
float baseRate,
unsigned short coveredHours,
float overageRate,
unsigned short hoursConsumed);
Refactor your code so that the functions for packages A, B, and C make a single call to the general-purpose calculatePackages function and return the same results.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!