Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

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
Check Mark
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

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