An internet service provider has three different subscription packages for its c
ID: 3638894 • Letter: A
Question
An internet service provider has three different subscription packages for its customers.Package A: For $9.95 per month 10 hours of access are provided. Additional hours are $2.00 per hour
Package B: For $14.95 per month 20 hours of access are provided. Additional hours are $1.00 per hour
Package C: For $19.95 per month unlimited access is provided.
Write a program in c++ that calculates a customers monthly bill. It should ask which package the customer has purchased and how many hours were used. It should then display the total amount due.
Input validation: be surethe user only selects package A,B,or,C. Also the numberof hours used in a month cannot exceed 744.
Months with 30 days have 720 hours, and months with 31 days have 744 hours. February with 28 days has 672 hours. Enhance the input validation of the internet service provider to ask the user for the month(by name), and validating that the number of hours entered is not more than the maximum for the entire month.
please help
Explanation / Answer
Hi, in your switch you basically just want to check whether the hours used is greater than the regular hours. If it is then do your normal calculation, if it isn't then skip your calculation and set totalFee to the monthlyFee. case 'A': monthlyFee = 9.95; regularHours = 10; if(hoursUsed>regularHours) { additionalHours = hoursUsed - regularHours; additionalHoursFee = additionalHours * 2.00; totalFee = monthlyFee + additionalHoursFee; } else { totalFee = monthlyFee; } JOptionPane.showMessageDialog(null,"Th… total charges is $" + totalFee + "."); break;
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.