Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create C++ Code for a program for Stumpy's Cell Phone Company that accepts the number of text messages for a customer for one month and

Create C++ Code for a program for Stumpy's Cell Phone Company that accepts the number of text messages for a customer for one month and displays the bill for text messages.

If the user enters a negative number the program should display an error message.

If the user enters number greater than or equal to 0 your program should call a function that given the number of text messages, returns the amount to be charged. The program will then display a message stating the amount of the monthly bill for text messages.

Stumpy's charges customers a basic rate of $5 per month for their text message service. Additional rates are as follows:

The first 60 messages per month, regardless of message length, are included in the basic bill.

An additional five cents is charged for each text message after the 60th message, up to and including 180 messages.

An additional 10 cents is charged for each text message after the 180th message.

Federal, state, and local taxes add a total of 12 percent to each bill.

This is the pseudocode I have

Begin module main

// Declare variables

Declare Integer numMessages

Declare Real totalBill

// Read number of messages for the month

Display Enter number of text messages for the month:

Input numMessages

// Check for invalid input

If numMessages < 0

Display Invalid input number of messages cannot be negative

Else

// Call function to calculate the total bill

totalBill = calcBill(numMessages)

// Display the bill

Display Your bill for text messages this month is , totalBill

End module main

Begin module calcBill(Integer numTexts)

// Declare variables

Declare Real bill = 5.0 // Initialize to the base amount

// Set up constant for base rate and additional charges

Constant Real BASE_RATE = 5.00

Constant Real MSG_UPTO_180 = 0.05

Constant Real MSG_OVER_180 = 0.10

Constant Real TAX_RATE = 0.12

// Check for messages over 180

If numTexts > 180

Set bill = bill + ((numTexts 180) * MSG_OVER_180) + (120 * MSG_UPTO_180)

// Check for messages under 181 but over 60

Else if numTexts > 60

Set bill = bill + ((numTexts 60) * MSG_UPTO_180

// Calculate bill with 12% tax

bill = bill + (bill * TAX_RATE)

Return bill

End module calcBill

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_2

Step: 3

blur-text-image_3

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

Professional SQL Server 2012 Internals And Troubleshooting

Authors: Christian Bolton, Justin Langford

1st Edition

1118177657, 9781118177655

More Books

Students also viewed these Databases questions

Question

What additional visualizations might you include on your dashboard?

Answered: 1 week ago