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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education