Find the amount to charge people of varying ages for a concert ticket.
When the person is under 18, the charge is 10;whenthepersonis60orover,thechargeis5; all others are charged 10
Age > = 18 and Age < 60 5
Assistant
Here's how to create an algorithm and a flowchart for determining the concert ticket price based on a person's age.
Algorithm:
Start
Input Age: Read the age of the person.
If Age < 18:
15.Theconditionsarethefollowing:AgeChargeAge<18
15Age>=60
Write the algorithm, then Draw FlowChart (positive or negative).
حل هذا االسؤال
Set Charge = $10
Else If Age >= 18 AND Age < 60:
Set Charge = $15
Else If Age >= 60:
Set Charge = $5
Output Charge: Display the charge.
End
Flowchart:
You can create a flowchart based on the algorithm. Here’s a textual description of how the flowchart should be constructed:
Start: Begin with a "Start" oval.
Input Age: Use a parallelogram for inputting the age.
Decision 1: Use a diamond shape to check if Age < 18.
If Yes, move to a process box that sets Charge to $10, then go to Output Charge.
If No, move to Decision 2.
Decision 2: Use another diamond to check if Age >= 18 AND Age < 60.
If Yes, move to a process box that sets Charge to $15, then go to Output Charge.
If No, move to a process box that sets Charge to $5 (this means Age >= 60) and then go to Output Charge.
Output Charge: Use a parallelogram to display the charge.
End: Complete with an "End" oval.
Positive Flowchart Representation:
[Start]
|
[Input Age]
|
v
[Age < 18?] -----> No -----> [Age >= 18 and Age < 60?] -----> No
/ Yes / Yes
v v
[Charge = $10] [Charge = $15]
| |
| |
v v
[Output Charge] ---> [Charge = $5]
|
v
[End]
Negative Flowchart Representation:
The “negative” flowchart indicates the rejected conditions. However, in the context of age checking (since everyone falls into one valid age group), it might confuse rather than help. The positive representation is clearer, as the age input will dictate the valid ticket price every time, ensuring all possible ages are covered.
Summary:
Using the provided algorithm and flowchart, you can effectively determine the ticket prices for concert attendees based on their ages. Each age group is clearly defined, ensuring proper pricing without ambiguity.