Create a flowchart using Flowgorithm and Pseudocode for the following program example: You are to design a program for Alexander's Coffee Shop providing customer research data.  When a customer places an order, the clerk asks the customer for their zip code and age.  The clerk enters this data as well as the number of items purchased.  The program should operate continuously until the clerk enters a 0 for the zip code at the end of the day. If the clerk enters an invalid age (defined as less than 10 or more than 100), an error message is displayed and the program re-prompts the clerk continuously to enter a valid age.  At the end of the program, display the average customer age and the total number of items purchased.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter5: Repetition Statements
Section: Chapter Questions
Problem 5PP
icon
Related questions
Question

Create a flowchart using Flowgorithm and Pseudocode for the following program example:

You are to design a program for Alexander's Coffee Shop providing customer research data.  When a customer places an order, the clerk asks the customer for their zip code and age.  The clerk enters this data as well as the number of items purchased.  The program should operate continuously until the clerk enters a 0 for the zip code at the end of the day. If the clerk enters an invalid age (defined as less than 10 or more than 100), an error message is displayed and the program re-prompts the clerk continuously to enter a valid age.  At the end of the program, display the average customer age and the total number of items purchased.

Expert Solution
Step 1

Here is the pseudocode for the program:

Start
Declare variables:
- total_items_purchased = 0
- total_customers = 0
- total_age = 0
- zip_code = -1
- age = -1
- num_items = -1

While zip_code != 0 Do
    Input zip_code
    If zip_code != 0 Then
        Input age
        While age < 10 OR age > 100 Do
            Display "Invalid age. Please enter a valid age."
            Input age
        End While
        Input num_items
        Set total_age = total_age + age
        Set total_items_purchased = total_items_purchased + num_items
        Set total_customers = total_customers + 1
    End If
End While

If total_customers > 0 Then
    Set average_age = total_age / total_customers
    Display "Average customer age: ", average_age
End If
Display "Total items purchased: ", total_items_purchased
End

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Mathematical functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning