Presentation is loading. Please wait.

Presentation is loading. Please wait.

Program #2 Cell Phone Usage ….Let’s start with understanding the problem!

Similar presentations


Presentation on theme: "Program #2 Cell Phone Usage ….Let’s start with understanding the problem!"— Presentation transcript:

1 Program #2 Cell Phone Usage ….Let’s start with understanding the problem!

2 Understanding the Problem What is the input? Where does the input come from? What is the output? Where should the output go? Any calculations we need to worry about? Who is the user?

3 Writing the Algorithm Step #1: Welcome the User Decide what you want to say, plan it out here in the algorithm Think about who your user is…to make sure the tone/words used are appropriate Be creative

4 Algorithm Step #2: Get the Regular monthly charges from the user Prompt the user for the monthly access charges Read in the monthly access charges What kind of variable do you think we will need? Echo the monthly access charges

5 Algorithm Step #3: Get the Voice Charges from the user Prompt the user for the number of minutes allowed (allowance), number of minutes currently used, and cost of minutes over the allowance. Spend some time planning what this prompt looks like. You could do 3 separate prompts if you’d like…. Read in the allowance, used minutes, and cost of overages Echo the allowance, used minutes and cost of overages. Plan out how you want this echo to look like!

6 Alternate Step #3 Get the Voice Usage Charges Prompt for the # minutes allowed Read in the allowance and echo it Prompt for the # minutes used Read in the minutes used and echo it Prompt for the cost overages for too many minutes used Read in the cost and echo it

7 Step #4 Get the Data Usage charges Prompt for the Text messaging allowance (# of messages allowed before charged), number of messages already sent, and the rate per minute over the allowance Read in the allowance, number of messages, and rate (think about what data types you will need) Echo the allowance, number of messages or rate

8 Alternate Step #4 Step #4: Get the Data Usage Charges Prompt for the # text messages allowed Read in the # text messages allowed Echo the # text messages allowed Prompt for the # text messages sent Read in the # text messages sent Echo the # text messages sent Prompt for the cost of texting Red in the cost of texting Echo the cost

9 Step #5 Step #5: Calculate the total charges so far… Calculate Voice Charges For voice, subtract the allowance from the number of minutes used… If the result is greater than zero, the result needs to be multiplied by the cost Otherwise, there are no additional charges

10 More Step #5 Calculate Data Charges Subtract the allowance (# messages allowed) from the # of messages used If the result is greater than zero Then the result should be multiplied by the cost of texting Otherwise, there are no additional charges

11 Last part of Step #5 Now calculate the grand total Add together the monthly access charges, the voice usage charges, and the data usage charges (Think about what kind of variable you are going to need for this! Where should your answer be saved….?)

12 Steps #6 and #7 Display the results to the user Plan out what you want to say as part of your algorithm Time to sign off! Send a termination message thanking the user Again, think about who your user is and make an appropriate message!

13 Deck Check it now… Now, go through the algorithm Is it in order? Does it make sense? Do you understand each sentence Is it precise enough that you can now create a C++ program from this? Let’s try in class on a few of the steps!

14 Create a Test Plan But, we are not yet done with the planning stage It is now time to create a test plan Create a list of what you think the user will type in, and what the answers should be when you run your program!


Download ppt "Program #2 Cell Phone Usage ….Let’s start with understanding the problem!"

Similar presentations


Ads by Google