The Average Age Step 1: Start Raptor and save your document as Lab 5-2AverageAge. The .rap file extension will be added automatically. Step 2: The next loop to code is the pseudocode from Step 12, Lab 5.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.
The Average Age Step 1: Start Raptor and save your document as Lab 5-2AverageAge. The .rap file extension will be added automatically. Step 2: The next loop to code is the pseudocode from Step 12, Lab 5.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.
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
The Average Age
Step 1: Start Raptor and save your document as Lab 5-2AverageAge. The .rap file extension will be added automatically.
Step 2: The next loop to code is the pseudocode from Step 12, Lab 5.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.
Expert Solution
Step 1
Algorithm:
- Initialize the variables
counter
,totalAge
,averageAge
,age
, andnumber
to 1, 0, 0, 0, and 0 respectively. - Prompt the user to enter the number of ages they want to input and store it in the
number
variable. - Enter a loop that will run
number
times. - Prompt the user to enter an age and store it in the
age
variable. - Add the value of
age
to thetotalAge
variable. - Increment the
counter
variable by 1. - End the loop.
- Calculate the average age by dividing
totalAge
bynumber
and store it in theaverageAge
variable. - Display the message "The average age is" followed by the value of
averageAge
, formatted with four decimal places. - End the program.
Trending now
This is a popular solution!
Step by step
Solved in 5 steps with 5 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.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