Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Program #2 PLEASE USE C++ Please implement Problem 25 on page 228 (similar, but not identical to Problem 23 in 7E). A scan of the

Program #2 PLEASE USE C++

Please implement Problem 25 on page 228 (similar, but not identical to Problem 23 in 7E). A scan of the problem is provided below.

Note that this problem requires the implementation of a small menu system (see Section 4.10) as well as input validation (see Section 4.11). The menu system can be implemented at our current level with an if-else-if ladder or by a switch statement.

The input validation can be done with standard if statements. Program 4-18 is an excellent model for the solution to this problem, at least as far as the basic structure is concerned. Make sure you understand exactly what is to be calculated in each package. For example, if Package A is chosen and the user wants 650 minutes, how should the monthly bill be calculated exactly? I suggest you work out those equations in pseudo-code before you begin writing the program.

Also, take note of the input validation requirements at the end of the problem (in italics). They specify that only A, B, or C is allowed as the input for the package. Have your program accept either upper or lower case letters for the package choice (e.g., either A or a will choose package A). Anything outside of the range A C or the range a c should be considered an error. Also, note that the problem asks the user to enter how many minutes were used even if Package C is chosen. This may seem redundant in the case of Package C, but it will be useful in the following modification. Consequently, your program should ask both of those questions up front, i.e., the package and the number of minutes, before it enters the if-else-if structure to do the processing on the package. CS1336 Programming Fundamentals page: 3

Bonus Opportunity Finally,

for a 5% bonus, lets modify the problem in the following way to make it more useful. Have your program calculate the monthly bill for all three packages given the number of minutes entered by the user. If the user chooses the package with the best monthly rate, report his monthly bill but also print a message congratulating him on making the right choice. If the user chooses a different package than the best one, then report the monthly bill for the package he choose but also inform him that he had a better option available and what the best rate and package would be. If you do all the work correctly without the bonus, then you will get 100% for this problem. If you do all the work correctly as well as the bonus, you will get 105% for this problem.

image text in transcribed

226 Chapter 4 Making Decisions 25. Mobile Service Provider A mobile phone service provider has three different subscription packages for its customers: Package A: For $39.99 per month 450 minutes are provided. Additional minutes are Package B: For $59.99 per month 900 minutes are provided. Additional minutes are Package C: For $69.99 per month unlimited minutes provided. Write a program that calculates a customer's monthly bill. It should ask which package the total amount due. S0.45 per minute. $0.40 per minute. the customer has purchased and how many minutes were used. It should then display Input Validation: Be sure the user only selects package A, B, or C

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

2nd Edition

0470624701, 978-0470624708

More Books

Students also viewed these Databases questions