introduction to computing
DESCRIPTION
A user can choose the item they want to buy from the vending machineTRANSCRIPT
-
Assignment
CMPF114 Introduction to Computing
Foundation in Information Technology Foundation in Computer Science
Prepared for: Miss Nur Liyana Binti Zakaria
Prepared by:
No Name ID H/P Signature 1 AHMAD ZAFIR BIN
AYUB
AT93226 0122269895
2 MUHAMMAD LUQMAN BIN ROZAINI
AK93308 0129248579
3 MUHAMMAD EHSAN BIN MOHD AZAM
AT93269 0194087355
4 MOHD NASSUHA BIN JAFRI
AT93255 0173308365
Last Updated:
-
Table of Content
1.0 Specification of Needs 1
2.0 Problem Analysis 2
3.0 Design and Algorithmic Representation 4
3.1 Pseudocode 5
3.2 Flow Chart 6
4.0 Testing and Verification 10
5.0 Source Code 12
-
1.0 Specification of Needs
- A user can choose the item they want to buy from the vending machine.
- The vending machine program can display the amount need to be paid by a user and
display balance returning to user.
2.0 Problem Analysis
Input 2 input; the item chosen by user and the payment made by user.
Output 1 output; balance returning to user.
Constraints There is no negative value.
- The vending machine only accept note RM1 and RM5.
- Items can be chosen only between A1 A9, B1 B6, and C1 C5.
3.0 Design and Algorithmic Representation
3.1 Pseudocode
Begin
Read Item, payment
If item = "A1" And pay = "1" Then
price = 1.0 - 1.0
print "Your balance is " & "RM" & price
ElseIf item = "A1" And pay = "5" Then
price = 5.0 - 1.0
print "Your balance is " & "RM" & price
ElseIf item = "A2" And pay = "1" Then
price = 1.0 - 1.0
-
print "Your balance is " & "RM" & price
ElseIf item = "A2" And pay = "5" Then
price = 5.0 - 1.0
print "Your balance is " & "RM" & price
ElseIf item = "A3" And pay = "1" Then
price = 1.0 - 1.0
print "Your balance is " & "RM" & price
ElseIf item = "A3" And pay = "5" Then
price = 5.0 - 1.0
print "Your balance is " & "RM" & price
ElseIf item = "A4" And pay = "1" Then
price = 1.0 - 1.0
print "Your balance is " & "RM" & price
ElseIf item = "A4" And pay = "5" Then
price = 5.0 - 1.0
print "Your balance is " & "RM" & price
ElseIf item = "A5" And pay = "1" Then
price = 1.0 - 1.0
print "Your balance is " & "RM" & price
ElseIf item = "A5" And pay = "5" Then
price = 5.0 - 1.0
print "Your balance is " & "RM" & price
ElseIf item = "A6" And pay = "1" Then
-
price = 1.0 - 1.0
print "Your balance is " & "RM" & price
ElseIf item = "A6" And pay = "5" Then
price = 5.0 - 1.0
print "Your balance is " & "RM" & price
ElseIf item = "A7" And pay = "1" Then
price = 1.0 - 1.0
print "Your balance is " & "RM" & price
ElseIf item = "A7" And pay = "5" Then
price = 5.0 - 1.0
print "Your balance is " & "RM" & price
ElseIf item = "A8" And pay = "1" Then
price = 1.0 - 1.0
print "Your balance is " & "RM" & price
ElseIf item = "A8" And pay = "5" Then
price = 5.0 - 1.0
print "Your balance is " & "RM" & price
ElseIf item = "A9" And pay = "1" Then
price = 1.0 - 1.0
print "Your balance is " & "RM" & price
ElseIf item = "A9" And pay = "5" Then
price = 5.0 - 1.0
print "Your balance is " & "RM" & price
-
ElseIf item = "B1" And pay = "1" Then
Print "Insufficient, please add another RM2"
ElseIf item = "B1" And pay = "2" Then
Print "Insufficient, please add another RM1"
ElseIf item = "B1" And pay = "3" Then
price = 3.0 - 3.0
print "Your balance is " & "RM" & price
ElseIf item = "B1" And pay = "5" Then
price = 5.0 - 3.0
print "Your balance is " & "RM" & price
ElseIf item = "B2" And pay = "1" Then
Print "Insufficient, please add another RM2"
ElseIf item = "B2" And pay = "2" Then
Print "Insufficient, please add another RM1"
ElseIf item = "B2" And pay = "3" Then
price = 3.0 - 3.0
print "Your balance is " & "RM" & price
ElseIf item = "B2" And pay = "5" Then
price = 5.0 - 3.0
print "Your balance is " & "RM" & price
ElseIf item = "B3" And pay = "1" Then
-
Print "Insufficient, please add another RM2"
ElseIf item = "B3" And pay = "2" Then
Print "Insufficient, please add another RM1"
ElseIf item = "B3" And pay = "3" Then
price = 3.0 - 3.0
print "Your balance is " & "RM" & price
ElseIf item = "B3" And pay = "5" Then
price = 5.0 - 3.0
print "Your balance is " & "RM" & price
ElseIf item = "B4" And pay = "1" Then
Print "Insufficient, please add another RM2"
ElseIf item = "B4" And pay = "2" Then
Print "Insufficient, please add another RM1"
ElseIf item = "B4" And pay = "3" Then
price = 3.0 - 3.0
print "Your balance is " & "RM" & price
ElseIf item = "B4" And pay = "5" Then
price = 5.0 - 3.0
print "Your balance is " & "RM" & price
ElseIf item = "B5" And pay = "1" Then
-
Print "Insufficient, please add another RM2"
ElseIf item = "B5" And pay = "2" Then
Print "Insufficient, please add another RM1"
ElseIf item = "B5" And pay = "3" Then
price = 3.0 - 3.0
print "Your balance is " & "RM" & price
ElseIf item = "B5" And pay = "5" Then
price = 5.0 - 3.0
print "Your balance is " & "RM" & price
ElseIf item = "B6" And pay = "1" Then
Print "Insufficient, please add another RM2"
ElseIf item = "B6" And pay = "2" Then
Print "Insufficient, please add another RM1"
ElseIf item = "B6" And pay = "3" Then
price = 3.0 - 3.0
print "Your balance is " & "RM" & price
ElseIf item = "B6" And pay = "5" Then
price = 5.0 - 3.0
print "Your balance is " & "RM" & price
ElseIf item = "C1" And pay = "1" Then
Print " Insufficient, please add another RM1"
-
ElseIf item = "C1" And pay = "2" Then
price = 2.0 - 2.0
print "Your balance is " & "RM" & price
ElseIf item = "C1" And pay = "5" Then
price = 5.0 - 2.0
print "Your balance is " & "RM" & price
ElseIf item = "C2" And pay = "1" Then
Print " Insufficient, please add another RM1"
ElseIf item = "C2" And pay = "2" Then
price = 2.0 - 2.0
print "Your balance is " & "RM" & price
ElseIf item = "C2" And pay = "5" Then
price = 5.0 - 2.0
print "Your balance is " & "RM" & price
ElseIf item = "C3" And pay = "1" Then
print " Insufficient, please add another RM1"
ElseIf item = "C3" And pay = "2" Then
price = 2.0 - 2.0
print "Your balance is " & "RM" & price
ElseIf item = "C3" And pay = "5" Then
price = 5.0 - 2.0
print "Your balance is " & "RM" & price
-
ElseIf item = "C4" And pay = "1" Then
Print " Insufficient, please add another RM1"
ElseIf item = "C4" And pay = "2" Then
price = 2.0 - 2.0
print "Your balance is " & "RM" & price
ElseIf item = "C4" And pay = "5" Then
price = 5.0 - 2.0
print "Your balance is " & "RM" & price
ElseIf item = "C5" And pay = "1" Then
Print " Insufficient, please add another RM1"
ElseIf item = "C5" And pay = "2" Then
price = 2.0 - 2.0
print "Your balance is " & "RM" & price
ElseIf item = "C5" And pay = "5" Then
price = 5.0 - 2.0
print "Your balance is " & "RM" & price
Else
Print "Invalid Item...Please put the correct item codes
End If
End
-
3.2 FLOWCHART :
BEGIN
READ
ITEM , PAY
IF ITEM = "A1" AND
PAY = "1" THEN
YES
NO PRICE = 1.0 1.0
IF ITEM = "A1" AND
PAY = "5" THEN
PRICE = 5.0 1.0
YES
IF ITEM = "A2" AND
PAY = "1" THEN
PRICE = 1.0 1.0
YES
NO
NO
PRINT
PRICE
PRINT
PRICE
PRINT
PRICE
-
IF ITEM = "A2" AND
PAY = "5" THEN
YES
NO PRICE = 5.0 1.0
IF ITEM = "A3" AND
PAY = "1" THEN
PRICE = 1.0 1.0
YES
IF ITEM = "A3" AND
PAY = "5" THEN
PRICE = 5.0 1.0
YES
NO
NO
IF ITEM = "A4" AND
PAY = "1" THEN
PRICE = 1.0 1.0
YES
NO
PRINT
PRICE
PRINT
PRICE
PRINT
PRICE
PRINT
PRICE
-
IF ITEM = "A4" AND
PAY = "5" THEN
YES
NO PRICE = 5.0 1.0
IF ITEM = "A5" AND
PAY = "1" THEN
PRICE = 1.0 1.0
YES
IF ITEM = "A5" AND
PAY = "5" THEN
PRICE = 5.0 1.0
YES
NO
NO
IF ITEM = "A6" AND
PAY = "1" THEN
PRICE = 1.0 1.0
YES
NO
PRINT
PRICE
PRINT
PRICE
PRINT
PRICE
PRINT
PRICE
-
IF ITEM = "A6" AND
PAY = "5" THEN
YES
NO PRICE = 5.0 1.0
IF ITEM = "A7" AND
PAY = "1" THEN
PRICE = 1.0 1.0
YES
IF ITEM = "A7" AND
PAY = "5" THEN
PRICE = 5.0 1.0
YES
NO
NO
IF ITEM = "A8" AND
PAY = "1" THEN
PRICE = 1.0 1.0
YES
NO
PRINT
PRICE
PRINT
PRICE
PRINT
PRICE
PRINT
PRICE
-
IF ITEM = "A8" AND
PAY = "5" THEN
YES
NO PRICE = 5.0 1.0
IF ITEM = "A9" AND
PAY = "1" THEN
PRICE = 1.0 1.0
YES
IF ITEM = "A9" AND
PAY = "5" THEN
PRICE = 5.0 1.0
YES
NO
NO
IF ITEM = "B1" AND
PAY = "1" THEN
PRICE = 1.0 3.0
YES
NO
PRINT
PRICE
PRINT
PRICE
PRINT
PRICE
PRINT
INSUFFICIENT,
PLEASE ADD
ANOTHER RM2
-
IF ITEM = "B1" AND
PAY = "2" THEN
YES
NO PRICE = 2.0 3.0
IF ITEM = "B1" AND
PAY = "3" THEN
PRICE = 3.0 3.0
YES
IF ITEM = "B1" AND
PAY = "5" THEN
PRICE = 5.0 1.0
YES
NO
NO
IF ITEM = "B2" AND
PAY = "1" THEN
PRICE = 1.0 3.0
YES
NO
PRINT
INSUFFICIENT,
PLEASE ADD
ANOTHER RM1
PRINT
PRICE
PRINT
PRICE
PRINT
INSUFFICIENT,
PLEASE ADD
ANOTHER RM2
-
IF ITEM = "B2" AND
PAY = "2" THEN
YES
NO PRICE = 2.0 3.0
IF ITEM = "B2" AND
PAY = "3" THEN
PRICE = 3.0 3.0
YES
IF ITEM = "B2" AND
PAY = "5" THEN
PRICE = 5.0 1.0
YES
NO
NO
IF ITEM = "B3" AND
PAY = "1" THEN
PRICE = 1.0 3.0
YES
NO
PRINT
INSUFFICIENT,
PLEASE ADD
ANOTHER RM1
PRINT
PRICE
PRINT
PRICE
PRINT
INSUFFICIENT,
PLEASE ADD
ANOTHER RM2
-
IF ITEM = "B3" AND
PAY = "2" THEN
YES
NO PRICE = 2.0 3.0
IF ITEM = "B3" AND
PAY = "3" THEN
PRICE = 3.0 3.0
YES
IF ITEM = "B3" AND
PAY = "5" THEN
PRICE = 5.0 1.0
YES
NO
NO
IF ITEM = "B4" AND
PAY = "1" THEN
PRICE = 1.0 3.0
YES
NO
PRINT
INSUFFICIENT,
PLEASE ADD
ANOTHER RM1
PRINT
PRICE
PRINT
PRICE
PRINT
INSUFFICIENT,
PLEASE ADD
ANOTHER RM2
-
IF ITEM = "B4" AND
PAY = "2" THEN
YES
NO PRICE = 2.0 3.0
IF ITEM = "B4" AND
PAY = "3" THEN
PRICE = 3.0 3.0
YES
IF ITEM = "B4" AND
PAY = "5" THEN
PRICE = 5.0 1.0
YES
NO
NO
IF ITEM = "B5" AND
PAY = "1" THEN
PRICE = 1.0 3.0
YES
NO
PRINT
INSUFFICIENT,
PLEASE ADD
ANOTHER RM1
PRINT
PRICE
PRINT
PRICE
PRINT
INSUFFICIENT,
PLEASE ADD
ANOTHER RM2
-
IF ITEM = "B5" AND
PAY = "2" THEN
YES
NO PRICE = 2.0 3.0
IF ITEM = "B5" AND
PAY = "3" THEN
PRICE = 3.0 3.0
YES
IF ITEM = "B5" AND
PAY = "5" THEN
PRICE = 5.0 1.0
YES
NO
NO
IF ITEM = "B5" AND
PAY = "1" THEN
PRICE = 1.0 3.0
YES
NO
PRINT
INSUFFICIENT,
PLEASE ADD
ANOTHER RM1
PRINT
PRICE
PRINT
PRICE
PRINT
INSUFFICIENT,
PLEASE ADD
ANOTHER RM2
-
IF ITEM = "B5" AND
PAY = "2" THEN
YES
NO PRICE = 2.0 3.0
IF ITEM = "B5" AND
PAY = "3" THEN
PRICE = 3.0 3.0
YES
IF ITEM = "B5" AND
PAY = "5" THEN
PRICE = 5.0 1.0
YES
NO
NO
IF ITEM = "B6" AND
PAY = "1" THEN
PRICE = 1.0 3.0
YES
NO
PRINT
INSUFFICIENT,
PLEASE ADD
ANOTHER
RM1
PRINT
PRICE
PRINT
PRICE
PRINT
INSUFFICIENT,
PLEASE ADD
ANOTHER RM2
-
IF ITEM = "B6" AND
PAY = "2" THEN
YES
NO PRICE = 2.0 3.0
IF ITEM = "B6" AND
PAY = "3" THEN
PRICE = 3.0 3.0
YES
IF ITEM = "B6" AND
PAY = "5" THEN
PRICE = 5.0 1.0
YES
NO
NO
IF ITEM = "C1" AND
PAY = "1" THEN
PRICE = 1.0 2.0
YES
NO
PRINT
INSUFFICIENT,
PLEASE ADD
ANOTHER RM1
PRINT
PRICE
PRINT
PRICE
PRINT
INSUFFICIENT,
PLEASE ADD
ANOTHER RM1
-
IF ITEM = "C1" AND
PAY = "2" THEN
YES
NO PRICE = 2.0 2.0
IF ITEM = "C1" AND
PAY = "5" THEN
PRICE = 5.0 2.0
YES
IF ITEM = "C2" AND
PAY = "1" THEN
PRICE = 1.0 2.0
YES
NO
NO
IF ITEM = "C2" AND
PAY = "2" THEN
PRICE = 2.0 2.0
YES
NO
PRINT PRICE
PRINT
PRICE
PRINT
INSUFFICIENT,
PLEASE ADD
ANOTHER RM1
PRINT PRICE
-
IF ITEM = "C2" AND
PAY = "5" THEN
YES
NO PRICE = 5.0 2.0
IF ITEM = "C3" AND
PAY = "1" THEN
PRICE = 1.0 2.0
YES
IF ITEM = "C3" AND
PAY = "2" THEN
PRICE = 2.0 2.0
YES
NO
NO
IF ITEM = "C3" AND
PAY = "5" THEN
PRICE = 5.0 2.0
YES
NO
PRINT
INSUFFICIENT
, PLEASE ADD
ANOTHER
RM1
PRINT
PRICE
PRINT
PRICE
PRINT
PRICE
-
IF ITEM = "C4" AND
PAY = "1" THEN
YES
NO PRICE = 1.0 2.0
IF ITEM = "C4" AND
PAY = "2" THEN
PRICE = 2.0 2.0
YES
IF ITEM = "C4" AND
PAY = "5" THEN
PRICE = 2.0 2.0
YES
NO
NO
IF ITEM = "C5" AND
PAY = "1" THEN
PRICE = 1.0 2.0
YES
NO
PRINT
INSUFFICIENT,
PLEASE ADD
ANOTHER RM1
PRINT
PRICE
PRINT
PRICE
PRINT
INSUFFICIENT,
PLEASE ADD
ANOTHER RM1
-
IF ITEM = "C5" AND
PAY = "2" THEN
YES
NO PRICE = 2.0 2.0
IF ITEM = "C5" AND
PAY = "5" THEN
PRICE = 5.0 2.0
YES
NO
PRINT
PRICE
PRINT
PRICE
PRINT INVALID
ITEMPLEASE PUT THE
CORRECT ITEM CODE
END
-
1.0 Testing and Verification
-
2.0 Source Code
Public Class frmOrder
Private Sub cdmCalculate_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cdmCalculate.Click
Dim item As String
Dim price, pay As Double
'for variable declaration'
item = txtItem.Text
pay = txtPay.Text
If item = "A1" And pay = "1" Then
price = 1.0 - 1.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item AI if the amount paid equal to RM1.00'
ElseIf item = "A1" And pay = "5" Then
price = 5.0 - 1.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item A1 if the amount paid equal to RM5.00'
ElseIf item = "A2" And pay = "1" Then
price = 1.0 - 1.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item A2 if the amount paid equal to RM1.00'
ElseIf item = "A2" And pay = "5" Then
price = 5.0 - 1.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item A2 if the amount paid equal to RM5.00'
ElseIf item = "A3" And pay = "1" Then
price = 1.0 - 1.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item A3 if the amount paid equal to RM1.00'
ElseIf item = "A3" And pay = "5" Then
price = 5.0 - 1.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item A3 if the amount paid equal to RM5.00'
ElseIf item = "A4" And pay = "1" Then
price = 1.0 - 1.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item A4 if the amount paid equal to RM1.00'
ElseIf item = "A4" And pay = "5" Then
price = 5.0 - 1.0
txtDisplay.Text = "Your balance is " & "RM" & price
-
'balance for item A4 if the amount paid equal to RM5.00'
ElseIf item = "A5" And pay = "1" Then
price = 1.0 - 1.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item A5 if the amount paid equal to RM1.00'
ElseIf item = "A5" And pay = "5" Then
price = 5.0 - 1.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item A5 if the amount paid equal to RM5.00'
ElseIf item = "A6" And pay = "1" Then
price = 1.0 - 1.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item A6 if the amount paid equal to RM1.00'
ElseIf item = "A6" And pay = "5" Then
price = 5.0 - 1.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item A6 if the amount paid equal to RM5.00'
ElseIf item = "A7" And pay = "1" Then
price = 1.0 - 1.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item A7 if the amount paid equal to RM1.00'
ElseIf item = "A7" And pay = "5" Then
price = 5.0 - 1.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item A7 if the amount paid equal to RM5.00'
ElseIf item = "A8" And pay = "1" Then
price = 1.0 - 1.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item A8 if the amount paid equal to RM1.00'
ElseIf item = "A8" And pay = "5" Then
price = 5.0 - 1.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item A8 if the amount paid equal to RM5.00'
ElseIf item = "A9" And pay = "1" Then
price = 1.0 - 1.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item A9 if the amount paid equal to RM1.00'
ElseIf item = "A9" And pay = "5" Then
price = 5.0 - 1.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item A9 if the amount paid equal to RM5.00'
ElseIf item = "B1" And pay = "1" Then
txtDisplay.Text = "Insufficient, please add another RM2"
'display for item B1 if the amount paid equal to RM1'
ElseIf item = "B1" And pay = "2" Then
-
txtDisplay.Text = "Insufficient, please add another RM1"
'display for item B1 if the amount paid equal to RM2'
ElseIf item = "B1" And pay = "3" Then
price = 3.0 - 3.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item B1 if the amount paid equal to RM3'
ElseIf item = "B1" And pay = "5" Then
price = 5.0 - 3.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item B1 if the amount paid equal to RM5'
ElseIf item = "B2" And pay = "1" Then
txtDisplay.Text = "Insufficient, please add another RM2"
'display for item B2 if the amount paid equal to RM1'
ElseIf item = "B2" And pay = "2" Then
txtDisplay.Text = "Insufficient, please add another RM1"
'display for item B2 if the amount paid equal to RM2'
ElseIf item = "B2" And pay = "3" Then
price = 3.0 - 3.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item B2 if the amount paid equal to RM3'
ElseIf item = "B2" And pay = "5" Then
price = 5.0 - 3.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item B2 if the amount paid equal to RM5'
ElseIf item = "B3" And pay = "1" Then
txtDisplay.Text = "Insufficient, please add another RM2"
'display for item B3 if the amount paid equal to RM1'
ElseIf item = "B3" And pay = "2" Then
txtDisplay.Text = "Insufficient, please add another RM1"
'display for item B3 if the amount paid equal to RM2'
ElseIf item = "B3" And pay = "3" Then
price = 3.0 - 3.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item B2 if the amount paid equal to RM3'
ElseIf item = "B3" And pay = "5" Then
price = 5.0 - 3.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item B3 if the amount paid equal to RM5'
ElseIf item = "B4" And pay = "1" Then
txtDisplay.Text = "Insufficient, please add another RM2"
'display for item B4 if the amount paid equal to RM1'
ElseIf item = "B4" And pay = "2" Then
-
txtDisplay.Text = "Insufficient, please add another RM1"
'display for item B4 if the amount paid equal to RM2'
ElseIf item = "B4" And pay = "3" Then
price = 3.0 - 3.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item B4 if the amount paid equal to RM3'
ElseIf item = "B4" And pay = "5" Then
price = 5.0 - 3.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item B4 if the amount paid equal to RM5'
ElseIf item = "B5" And pay = "1" Then
txtDisplay.Text = "Insufficient, please add another RM2"
'display for item B5 if the amount paid equal to RM1'
ElseIf item = "B5" And pay = "2" Then
txtDisplay.Text = "Insufficient, please add another RM1"
'display for item B5 if the amount paid equal to RM2'
ElseIf item = "B5" And pay = "3" Then
price = 3.0 - 3.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item B5 if the amount paid equal to RM3'
ElseIf item = "B5" And pay = "5" Then
price = 5.0 - 3.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item B5 if the amount paid equal to RM5'
ElseIf item = "B6" And pay = "1" Then
txtDisplay.Text = "Insufficient, please add another RM2"
'display for item B6 if the amount paid equal to RM1'
ElseIf item = "B6" And pay = "2" Then
txtDisplay.Text = "Insufficient, please add another RM1"
'display for item B6 if the amount paid equal to RM2'
ElseIf item = "B6" And pay = "3" Then
price = 3.0 - 3.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item B6 if the amount paid equal to RM3'
ElseIf item = "B6" And pay = "5" Then
price = 5.0 - 3.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item B6 if the amount paid equal to RM5'
ElseIf item = "C1" And pay = "1" Then
txtDisplay.Text = " Insufficient, please add another RM1"
'display for item C1 if the amount paid equal to RM1'
ElseIf item = "C1" And pay = "2" Then
price = 2.0 - 2.0
-
txtDisplay.Text = "Your balance is " & "RM" & price
'display for item C1 if the amount paid equal to RM2'
ElseIf item = "C1" And pay = "5" Then
price = 5.0 - 2.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item C1 if the amount paid equal to RM5'
ElseIf item = "C2" And pay = "1" Then
txtDisplay.Text = " Insufficient, please add another RM1"
'display for item C2 if the amount paid equal to RM1'
ElseIf item = "C2" And pay = "2" Then
price = 2.0 - 2.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item C2 if the amount paid equal to RM2'
ElseIf item = "C2" And pay = "5" Then
price = 5.0 - 2.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item C2 if the amount paid equal to RM5'
ElseIf item = "C3" And pay = "1" Then
txtDisplay.Text = " Insufficient, please add another RM1"
'display for item C3 if the amount paid equal to RM1'
ElseIf item = "C3" And pay = "2" Then
price = 2.0 - 2.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item C3 if the amount paid equal to RM2'
ElseIf item = "C3" And pay = "5" Then
price = 5.0 - 2.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item C3 if the amount paid equal to RM5'
ElseIf item = "C4" And pay = "1" Then
txtDisplay.Text = " Insufficient, please add another RM1"
'display for item C4 if the amount paid equal to RM1'
ElseIf item = "C4" And pay = "2" Then
price = 2.0 - 2.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item C4 if the amount paid equal to RM2'
ElseIf item = "C4" And pay = "5" Then
price = 5.0 - 2.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item C4 if the amount paid equal to RM5'
ElseIf item = "C5" And pay = "1" Then
txtDisplay.Text = " Insufficient, please add another RM1"
'display for item C5 if the amount paid equal to RM1'
ElseIf item = "C5" And pay = "2" Then
price = 2.0 - 2.0
txtDisplay.Text = "Your balance is " & "RM" & price
-
'balance for item C5 if the amount paid equal to RM2'
ElseIf item = "C5" And pay = "5" Then
price = 5.0 - 2.0
txtDisplay.Text = "Your balance is " & "RM" & price
'balance for item C5 if the amount paid equal to RM5'
Else
txtDisplay.Text = "Invalid Item...Please put the correct item
codes"
'Display message'
End If
End Sub
Private Sub cmdExit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdExit.Click
End
End Sub
End Class