2. Pizza and a Movie Write a loop to a) Prompt the user to enter pizza toppings. (they may make one or multiple I entries). Provide a sentinel value to allow them to quit. b) Prompt the user for their age for the purpose of computing the cost of their movie ticket. 3 or younger = free; age 4 12 = $10; Over age 12 = $12 c) Print a message informing them of their pizza order. d) Print a message informing them of their ticket cost. Output Example ~~~~~ Welcome to Pizza and a Movie (type quit when done)? What topping would you like on your pizza anchovies What topping would you like on your pizza (type quit when done)? mushrooms What topping would you like on your pizza (type quit when done)? spinach What topping would you like on your pizza (type quit when done)? quit How old are you? 19 Your pizza toppings will be anchovies, mushrooms, spinach, Your movie ticket cost is $12
Control structures
Control structures are block of statements that analyze the value of variables and determine the flow of execution based on those values. When a program is running, the CPU executes the code line by line. After sometime, the program reaches the point where it has to make a decision on whether it has to go to another part of the code or repeat execution of certain part of the code. These results affect the flow of the program's code and these are called control structures.
Switch Statement
The switch statement is a key feature that is used by the programmers a lot in the world of programming and coding, as well as in information technology in general. The switch statement is a selection control mechanism that allows the variable value to change the order of the individual statements in the software execution via search.
![### Pizza and a Movie
This educational exercise involves writing a program with a loop to gather user input and calculate costs based on age. The steps are as follows:
1. **Pizza Toppings Input:**
- Prompt the user to enter pizza toppings. Allow multiple entries until the user chooses to quit, using a sentinel value to exit the loop.
2. **Age Input for Movie Ticket Cost:**
- Prompt the user to enter their age to compute the movie ticket cost:
- Age 3 or younger: Free
- Age 4 to 12: $10
- Age over 12: $12
3. **Output:**
- Print a message informing the user of their selected pizza toppings.
- Print another message detailing the cost of their movie ticket.
#### Output Example:
```
~~~~~ Welcome to Pizza and a Movie ~~~~~
What topping would you like on your pizza (type quit when done)?
anchovies
What topping would you like on your pizza (type quit when done)?
mushrooms
What topping would you like on your pizza (type quit when done)?
spinach
What topping would you like on your pizza (type quit when done)? quit
How old are you?
19
Your pizza toppings will be anchovies, mushrooms, spinach,
Your movie ticket cost is $12
```](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fefd607aa-6776-4e28-838c-67fa22c2e02e%2Fb1891fd3-30f2-478b-ab18-b82881e83039%2Fryt93j_processed.jpeg&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)