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.
Max Function
Statistical function is of many categories. One of them is a MAX function. The MAX function returns the largest value from the list of arguments passed to it. MAX function always ignores the empty cells when performing the calculation.
Power Function
A power function is a type of single-term function. Its definition states that it is a variable containing a base value raised to a constant value acting as an exponent. This variable may also have a coefficient. For instance, the area of a circle can be given as:
Create a flowchart using Flowgorithm and Pseudocode for the following
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.
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
This is a popular solution!
Step by step
Solved in 2 steps