Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a complete C++ program that creates a monthly bill for the text messaging. Your cell phone company provides the following three text messaging plans.

  1. Write a complete C++ program that creates a monthly bill for the text messaging. Your cell phone company provides the following three text messaging plans.
  • Package A: Two Thumbs. For $9.95 per month, 100 text messages are allowed. Additional text messages are 15 cents each.
  • Package B: All Thumbs. For $14.95 per month, 200 text messages are allowed. Additional text messages are 10 cents each.
  • Package C: Lightning Thumbs. For $19.95 per month, unlimited text messaging is provided.

State sales tax is 7% and a fixed monthly Connection Fee charge of $1.99 is assessed on all plans.

There is no tax on the connection fee.

Your program should ask which package the customer has purchased and how many text messages were used during the month. It should then display the total amount due.

2. Run your program to make sure everything is working at this point.

3. Then, your program should ask the user whether they want to check other packages (using a while loop shown below). The following is a sample output (and matching while loop structure):

char checkPackage = 'Y';

while(checkPackage == 'Y')

{

// ask user inputs &

// calculate & display the bill

cout << "Do you want to check out another package (Y, N)? ";

cin >> checkPackage;

}

(Sample output)

What package did you purchase (A, B, C)? B

How many messages did you send this month? 243

Your bill is: $22.59

Do you want to check out another package (Y, N)? Y

What package did you purchase (A, B, C)? C

How many messages did you send this month? 243

Your bill is: $23.34

Do you want to check out another package (Y, N)? N

4. Be sure to debug and test your program with several different inputs.

5. Turn in your program Close your project (Close Close solution OR exit Visual Studio) and turn in one copy of the.cpp file. If you want to do the Bonus, you will need to work on the same source code (i.e., .cpp file) and turn in the revised one.

6. Bonus (1 point): If you finish early, modify your program to include input validations for the package and for the number of text messages. For example, your program should only consider A, B, or C for the package input and a positive number for the number of the messages input. When an invalid input is given, your program should display an error message and skip the bill calculation.

(Sample output)

What package did you purchase (A, B, C)? B

How many messages did you send this month? -15

Invalid number of messages!!!

Do you want to check out another package (Y, N)? Y

What package did you purchase (A, B, C)? C

How many messages did you send this month? 243

Your bill is: $23.34

Do you want to check out another package (Y, N)? N

(Sample output)

What package did you purchase (A, B, C)? H

Invalid package!!!

Do you want to check out another package (Y, N)? Y

What package did you purchase (A, B, C)? C

How many messages did you send this month? 243

Your bill is: $23.34

Do you want to check out another package (Y, N)? N

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

Advanced Oracle Solaris 11 System Administration

Authors: Bill Calkins

1st Edition

0133007170, 9780133007176

More Books

Students also viewed these Databases questions

Question

Evaluate three pros and three cons of e-prescribing

Answered: 1 week ago