Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help completing the pseudocode for the two boxes above. Thanks 1. Pseudocode and Stepwise Refinement When creating a small program, you have a

image text in transcribed

image text in transcribed

image text in transcribed

I need help completing the pseudocode for the two boxes above. Thanks

1. Pseudocode and Stepwise Refinement When creating a small program, you have a few basics to work with: variables, assignment statements, and input/output routines. You might also have some subroutines, objects, or other building blocks that have already been written by you or someone else. (Math and System routines fall into this category) You can build sequences of these basic instructions, and you can also combine them into more complex control structures such as while loops and if statements. Suppose you have a task in mind that you want the computer to perform. One way to proceed is to write a description of the task and take that description as an outline of the algorithm you want to develop. Then you can refine and elaborate that description, gradually adding steps and detail, until you have a complete algorithm that can be translated directly into programming language. This method is called stepwise refinement, and it is a type of top-down design. As you proceed through the stages of stepwise refinement, you can write out descriptions of your algorithm in pseudocode - informal instructions that imitate the structure of programing languages without the complete detail and perfect syntax of actual program code As an example, let's see how one might develop the program that computes value of an investment: Write a class that computes the amount of interest that is earned on an investment over a period of 5 years. The initial amount of the investment and the interest rate are input by the user. The value of the investment at the end of each year is output. One direct approach could be: Get the user's input Compute the value of the investment after 1 year Display the value Compute the value after 2 years Display the value Compute the value after 3 years Display the value Compute the value after 4 years Display the value Compute the value after 5 years Display the value This is correct, but rather repetitive. And seeing that repetition, you might notice an opportunity to use a loop, which would take less typing. More important, it would be more general: Essentially the same loop will work no matter how many years you want to process. Please complete the following algorithm that solve the problem with a while loop

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

Climate And Environmental Database Systems

Authors: Michael Lautenschlager ,Manfred Reinke

1st Edition

1461368332, 978-1461368335

More Books

Students also viewed these Databases questions

Question

What is the FLC, and why is it important to marketers?

Answered: 1 week ago

Question

Discuss the characteristics of emerging adulthood.

Answered: 1 week ago

Question

What is polarization? Describe it with examples.

Answered: 1 week ago

Question

6. Explain the power of labels.

Answered: 1 week ago

Question

5. Give examples of variations in contextual rules.

Answered: 1 week ago

Question

f. What stereotypes were reinforced in the commercials?

Answered: 1 week ago