Putting the Steps in Order In a previous exercise on "thinking like a computer, you were given some unordered steps for a candy sale program and asked to put them in order. The problem was as follows "Chocolate truffles cost $20 per pound for the first 5 pounds, but only $12 per pound for any amount in excess of 5 pounds. How would you compute the cost, stored in a variable named total, for any given amount of truffles?" There are a few slightly different ways that the steps can be ordered. Here's one that works well for our purposes 1. Create a variable named pounds that can store an integer. 2. Create a variable named total that can store a floating-point number. 3. Record the amount of truffles in the variable named pounds 4 If pounds is five or less, go to the next step, otherwise, go to Step 7. 5. Set total to pounds times 201 6. Go to Step 10, 7. Set total to 100 8. Subtract 5 from pounds 9. Multiply pounds by 12 and add it to total 10. End. Thinking at a Higher Level If we think about these steps in terms of modules, there are really only two major activities 1. Get the amount of truffles from the user. 2. Compute how much this amount of truffles will cost this actually reveals a bit of a flaw in our steps after computing the amount, there's nothing that actually displays the results back to the user
Putting the Steps in Order In a previous exercise on "thinking like a computer, you were given some unordered steps for a candy sale program and asked to put them in order. The problem was as follows "Chocolate truffles cost $20 per pound for the first 5 pounds, but only $12 per pound for any amount in excess of 5 pounds. How would you compute the cost, stored in a variable named total, for any given amount of truffles?" There are a few slightly different ways that the steps can be ordered. Here's one that works well for our purposes 1. Create a variable named pounds that can store an integer. 2. Create a variable named total that can store a floating-point number. 3. Record the amount of truffles in the variable named pounds 4 If pounds is five or less, go to the next step, otherwise, go to Step 7. 5. Set total to pounds times 201 6. Go to Step 10, 7. Set total to 100 8. Subtract 5 from pounds 9. Multiply pounds by 12 and add it to total 10. End. Thinking at a Higher Level If we think about these steps in terms of modules, there are really only two major activities 1. Get the amount of truffles from the user. 2. Compute how much this amount of truffles will cost this actually reveals a bit of a flaw in our steps after computing the amount, there's nothing that actually displays the results back to the user
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 5 images
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY