Gallery
Solution Cinema World
Share
Explore

icon picker
Solution

At the right hand side is the the task, starter code and code clips that pupils got.
Below is a link to the solution. You can right click open on replit to demo the answer to pupils and talk through the code.

complete IPO first version

IPO
===

Input
---
* customer name
* age
* film name
* number of tickets

Process
---
* ticketPrice
* totalTicketCost

Output
---
* display message with customer name, film name, number of tickets and total cost

complete pseudocode

Design pseudocode
======

Input
-----
1. get customerName text
2. get film name
3. get ticketsNumber number


Process
-------
1. set ticketPrice to 5
2. calculate totalTicketCost as ticketsNumber multiplied by ticketPrice

Output
------
1. display message with customer name, film name, number of tickets and total ticket cost


solution
including extension for additional requests (drinks)
# initialise variables
ticketCost = 5;
drinkCost = 2;

# ---- Input ----

# print blank line
print('\n')
# ask user for full name and store answer
fullName = input('Enter name: ')
# ask user for name of filme and store answer
filmName = input('Enter film name: ')
# ask user for number of tickets and store answer
numberOfTickets = int(input('Enter number of tickets: '))
# ask user for number of drinks and store answer
numDrink = int(input('Enter number of drinks: '))

# ---- Process ----

# calculate the total cost of tickets
totalTickets = numberOfTickets * ticketCost;
# calculate the total cost of drinks
totalDrinks = drinkCost * numDrink;
# calculate that total overall cost including tickets, popcorn and drinks
totalCost = totalTickets + totalDrinks;

# ---- Output ----

# display ticket confirmation
# print blank line
print('\n\n')

print('CINEMA WORLD')
print('------------')
print('\n')
print('Ticket confirmation')
print('\n')
# display full name
print('Customer name: ' + fullName)
# display film
print('Film title: ' + filmName)
# display number of tickets
print('Tickets ordered: ' + str(numberOfTickets))
# display number of tickets
print('Drinks ordered: ' + str(numDrink))
# display total cost
print('Amount to pay: £' + str(totalCost))

complete IPO including extension

IPO
===

Input
---
* customer name
* film name
* number of tickets
* number of drinks

Process
---
* ticketPrice

* drinksPrice

* drinksTotal

* ticketTotal

* totalCost

Output
---
* display message with customer name, film name, number of tickets and total cost

complete pseudocode

Design pseudocode
======

Input
-----
1. get customerName text input from keyboard
2. get filmName text input from keyboard
3. get ticketsNumber number input from keyboard
4. get drinksNumber number input from keyboard

Process
-------
1. set ticketPrice to 5
2. calculate ticketTotal as ticketsNumber multiplied by ticketPrice

3. set drinksPrice to 2
4. calculate drinksTotal as drinksNumber multiplied by drinksPrice
5. calculate totalCost as ticketTotal + drinksTotal

Output
------
1. display message with customer name, film name, number of tickets and total cost


Share
 
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.