0% found this document useful (0 votes)
143 views3 pages

VB Code Pizza March 2018 IGCSE Computer Science Pre Release

This document defines variables and lists used to order pizzas with different sizes, bases, and toppings. It contains a loop that prompts the user to select size, base, toppings and quantity for each pizza ordered. It tracks the total number of pizzas, bases, and sizes ordered and displays a summary at the end.

Uploaded by

Pranaya Padhy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
143 views3 pages

VB Code Pizza March 2018 IGCSE Computer Science Pre Release

This document defines variables and lists used to order pizzas with different sizes, bases, and toppings. It contains a loop that prompts the user to select size, base, toppings and quantity for each pizza ordered. It tracks the total number of pizzas, bases, and sizes ordered and displays a summary at the end.

Uploaded by

Pranaya Padhy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Const PsizeNo = 3

Const PbaseNo = 2
Const PtoppingNo = 6
Dim Lstsize(PsizeNo) As String
Dim Lstbase(PbaseNo) As String
Dim TotalNoPizzaOrdered As Integer
Dim TotalNoBaseOrdered As Integer
Dim TotalNoSizeOrdered As Integer
Dim NoOfToppings As Integer
Dim Lsttoppings(PtoppingNo) As String
Dim NextChoice As String
Dim WrongChoice As Boolean
WrongSize = True
WrongToppings = True
WrongBase = True
Lstsize(1) = "small"
Lstsize(2) = "medium"
Lstsize(3) = "large"
Lstbase(1) = "thick"
Lstbase(2) = "thin"
Lsttoppings(1) = "Pepperoni"
Lsttoppings(2) = "Chicken"
Lsttoppings(3) = "Extra cheese"
Lsttoppings(4) = "Mushrooms"
Lsttoppings(5) = "Spinach"
Lsttoppings(6) = "Olives"
NextPizza = True
TotalNoPizzaOrdered = 0
TotalNoBaseOrdered = 0
TotalNoSizeOrdered = 0
While NextPizza = True
Edit = "y"
While Edit = "y"
While WrongSize = True
WrongSize = False
Print "Enter pizza size number from the list below "
For i = 1 To 3
Print i, Lstsize(i)
Next
Psize = InputBox("enter size number 1,2 or 3")
Rem Size = Lstsize(Psize)

If Psize >= 1 And Psize <= 3 Then


TotalNoSizeOrdered = TotalNoSizeOrdered + 1
While WrongBase = True
WrongBase = False
Print "enter the base no from the list 1,2 or 3"
For i = 1 To 2
Print i, Lstbase(i)
Next
Pbase = InputBox("enter base no")

If Pbase >= 1 And Pbase <= 2 Then


TotalNoBaseOrdered = TotalNoBaseOrdered + 1
While WrongToppings = True
WrongToppings = False
Print "enter the toppings no from the list
1,2 or 3"
For i = 1 To 6
Print i, Lsttoppings(i)
Next
Ptoppings = InputBox("enter topping no")

If Ptoppings >= 1 And Ptoppings <= 6 Then


NoOfToppings = InputBox("enter how many
toppings you want")
TotalNoPizzaOrdered = TotalNoPizzaOrdered
+ NoOfToppings
Else
MsgBox "wrong toppings"
WrongToppings = True
End If
Wend
Else
MsgBox ("wrong base")
WrongBase = True
End If
Wend
Else
MsgBox "wrong size"
WrongSize = True
End If
Wend
NextChoice = InputBox("do you want to CONFIRM, EDIT OR CANCEL
your order ")
If NextChoice = "EDIT" Then
Edit = "y"
TotalNoPizzaOrdered = TotalNoPizzaOrdered - NoOfToppings
TotalNoSizeOrdered = TotalNoSizeOrdered - 1
TotalNoBaseOrdered = TotalNoBaseOrdered - 1
NextPizza = True
WrongSize = True
WrongBase = True
WrongToppings = True
ElseIf NextChoice = "CANCEL" Then
MsgBox "order cancelled"
Edit = "N"
NextPizza = False
End
ElseIf NextChoice = "CONFIRM" Then
MsgBox ("order placed")
Edit = "N"
NextPizza = False
End If
Wend
NextPizza = InputBox("Do you want to continue order for next pizza y
or n")
If NextPizza = "y" Then
NextPizza = True
WrongSize = True
WrongBase = True
WrongToppings = True
Else
NextPizza = False
End If
Wend

MsgBox ("You have ordered: " & TotalNoPizzaOrdered & "no of pizzas " &
"Total base: " & TotalNoBaseOrdered & " Total no of Size: " &
TotalNoSizeOrdered)

You might also like