Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This lab requires you to convert various pseudocode steps in Lab 6.1 to a flowchart. Use an application such as Raptor or Visio. The Seconds

This lab requires you to convert various pseudocode steps in Lab 6.1 to a flowchart. Use an application such as Raptor or Visio.

The Seconds Counter

Step 1: Start Raptor and save your document as Lab 6-2Seconds. The .rap file extension will be added automatically.

Step 2: The first loop to code is the pseudocode from Step 4, Lab 6.1. This loop will print 60 seconds to the screen. The complete pseudocode is below:

Constant Integer MAX_SECONDS = 60

Declare Integer seconds

For seconds = 1 to 60

Display "The second is ", seconds

End For

Step 3: Click the Loop symbol and add it between the Start and the End symbol. Above the Loop symbol, add two assignment statements. Set a variable named seconds to 1 and a variable named MAX_SECONDS to 60.

Step 4: Double click the Diamond symbol and add the condition that will execute the loop through 60 iterations.

Step 5: Add an output statement if the loop is NO. This statement will display the seconds variable to the screen.

Step 6: Add an assignment statement next that will increment the seconds variable by 1.

Step 7: Execute your flowchart to see if your output matches the following. If not, repeat the steps to identify the error and execute again.

The second is 1

The second is 2

The second is 3

..Continues from 4 to 57

The second is 58

The second is 59

The second is 60

----Run finished----

Step 8: Paste your finished flowchart in the space below.

PASTE FLOWCHART HERE

The Accumulator

Step 1: Start Raptor and save your document as Lab 6-2Accumulator. The .rap file extension will be added automatically.

Step 2: The next loop to code is the pseudocode from Step 10, Lab 6.1. This loop will take in a number and accumulate the total. The complete pseudocode is below:

Declare Integer counter

Declare Integer total = 0

Declare Integer number

For counter = 1 to 5

Display "Enter a number: "

Input number

Set total = total + number

End For

Display "The total is total: ", total

Step 3: Click the Loop symbol and add it between the Start and the End symbol. Above the Loop symbol, add three assignment statements. Set a variable named counter to 1, a variable named total to 0, and a variable named number to 0.

Step 4: Double click the Diamond symbol and add the condition that will execute the loop through 5 iterations.

Step 5: Add an input statement if the loop is NO. This statement will ask the user to enter a number.

Step 6: Add an assignment statement that will accumulate the total such as total = total + number.

Step 7: Add an assignment statement that will increment the counter variable by 1.

Step 8: Add an output statement outside of the loop if the condition is YES. This should display total.

Step 9: Execute your flowchart to see if your output matches the following. If not, repeat the steps to identify the error and execute again.

Input values are:

13

23

24

52

18

The expected output is:

The total is 130

----Run finished----

Step 10: Paste your finished flowchart in the space below.

PASTE FLOWCHART HERE

The Average Age

Step 1: Start Raptor and save your document as Lab 6-2AverageAge. The .rap file extension will be added automatically.

Step 2: The next loop to code is the pseudocode from Step 12, Lab 6.1. This loop will take in various amounts of ages and then find the average. The complete pseudocode is below:

Declare Integer counter

Declare Integer totalAge = 0

Declare Real averageAge = 0

Declare Integer age

Declare Integer number

Display "How many ages do you want to enter: "

Input number

For counter = 1 to number

Display "Enter age: "

Input age

Set totalAge = totalAge + age

End For

Set averageAge = totalAge / number

Display "The average age is ", averageAge

Step 3: Click the Loop symbol and add it between the Start and the End symbol. Above the Loop symbol, add five assignment statements. Set counter to 1, totalAge to 0, averageAge to 0, age to 0, and number to 0.

Step 4: Above the Loop symbol, add an Input symbol that asks the user how many ages they want to enter. Store the answer in the number variable.

Step 5: Double click the Diamond symbol and add the condition that will execute the loop as long as the number is less than the counter. This can be written as counter > number.

Step 6: Add an input statement if the loop is NO. This statement will ask the user to enter an age.

Step 7: Add an assignment statement that will accumulate the totalAge.

Step 8: Add an assignment statement that will increment the counter variable by 1.

Step 9: Add an assignment statement outside of the loop if the condition is YES. This should calculate the averageAge as averageAge = totalAge / number.

Step 10: Add an output statement outside of the loop if the condition is YES. This should display averageAge.

Step 11: Execute your flowchart to see if your output matches the following. If not, repeat the steps to identify the error and execute again.

Input values are:

4 how many ages to enter

45

67

34

27

The expected output is:

The average age is 43.2500

----Run finished----

Step 12: Paste your finished flowchart in the space below.

PASTE FLOWCHART HERE

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

Oracle9i Database Administrator Implementation And Administration

Authors: Carol McCullough-Dieter

1st Edition

0619159006, 978-0619159009

More Books

Students also viewed these Databases questions

Question

What is meant by the price of variety? Graph and explain.

Answered: 1 week ago

Question

Identify the steps in designing a product layout.

Answered: 1 week ago

Question

1. Discuss the four components of language.

Answered: 1 week ago

Question

f. What stereotypes were reinforced in the commercials?

Answered: 1 week ago