Recap - Ticket Price
Part of the PowerShell Basics section of Coddy's PowerShell journey. Lesson 15 of 28.
Challenge
EasyA cinema sells tickets by age, with half price on Tuesdays. Write the script that prints a ticket.
- Read a whole number with the prompt
Age, then a day name with the promptDay. - Under 12 the ticket is
Childand costs 8. From 65 up it isSeniorand costs 9. Every other age isAdultand costs 14. - On a Tuesday, a ticket that is not a
Childticket costs half its price. Day names are matched whatever their case. - Print
Ticket:and the type, thenPrice:and the price with 2 decimals.
With the input 35 and tuesday, your script prints:
Age: 35
Day: tuesday
Ticket: Adult
Price: 7.00With 10 and Saturday, it prints Ticket: Child and Price: 8.00.
Try it yourself
# Read the age and the day, then print the ticket
All lessons in PowerShell Basics
5Project: Password Checker
Project OverviewLength Check3Input And Conditions
Reading InputComparison OperatorsIf, ElseIf And ElseThe Switch StatementRecap - Ticket Price