Vous êtes sur la page 1sur 34

Assignment

CMPF114 Introduction to Computing


Foundation in Information Technology
Foundation in Computer Science

Prepared for: Miss Nur Liyana Binti Zakaria

Prepared by:
No
1

AHMAD
AYUB

Name
ZAFIR

ID
BIN AT93226

H/P
0122269895

MUHAMMAD
BIN ROZAINI

LUQMAN AK93308

0129248579

MUHAMMAD EHSAN BIN AT93269


MOHD AZAM

0194087355

MOHD
JAFRI

0173308365

NASSUHA

BIN AT93255

Last Updated:

Signature

Table of Content
1.0 Specification of Needs

2.0 Problem Analysis

3.0 Design and Algorithmic Representation

3.1 Pseudocode

3.2 Flow Chart

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

BEGIN
3.2 FLOWCHART :

READ
ITEM , PAY

IF ITEM = "A1" AND


PAY = "1" THEN

YES

PRICE = 1.0 1.0

NO

YES

PRICE = 5.0 1.0

PRINT
PRICE

IF ITEM = "A1" AND


PAY = "5" THEN

PRINT
PRICE

NO

IF ITEM = "A2" AND


PAY = "1" THEN

NO

YES

PRICE = 1.0 1.0

PRINT
PRICE

IF ITEM = "A2" AND


PAY = "5" THEN

YES

PRICE = 5.0 1.0

NO

YES

PRICE = 1.0 1.0

NO

IF ITEM = "A3" AND


PAY = "5" THEN

PRINT
PRICE

NO

YES

PRICE = 1.0 1.0

PRINT
PRICE

PRINT
PRICE

IF ITEM = "A3" AND


PAY = "1" THEN

IF ITEM = "A4" AND


PAY = "1" THEN

NO

YES

PRICE = 5.0 1.0

PRINT
PRICE

IF ITEM = "A4" AND


PAY = "5" THEN

YES

PRICE = 5.0 1.0

NO

YES

PRICE = 1.0 1.0

IF ITEM = "A5" AND


PAY = "1" THEN

NO

IF ITEM = "A5" AND


PAY = "5" THEN

PRINT
PRICE

NO

YES

PRICE = 1.0 1.0

PRINT
PRICE

PRINT
PRICE

IF ITEM = "A6" AND


PAY = "1" THEN

NO

YES

PRICE = 5.0 1.0

PRINT
PRICE

IF ITEM = "A6" AND


PAY = "5" THEN

YES

PRICE = 5.0 1.0

NO

YES

PRICE = 1.0 1.0

NO

IF ITEM = "A7" AND


PAY = "5" THEN

PRINT
PRICE

NO

YES

IF ITEM = "A8" AND


PAY = "1" THEN

PRICE = 1.0 1.0


NO

PRINT
PRICE

PRINT
PRICE

IF ITEM = "A7" AND


PAY = "1" THEN

YES

PRICE = 5.0 1.0

PRINT
PRICE

IF ITEM = "A8" AND


PAY = "5" THEN

YES

PRICE = 5.0 1.0

NO

YES

PRICE = 1.0 1.0

NO

IF ITEM = "A9" AND


PAY = "5" THEN

PRINT
PRICE

NO

YES

IF ITEM = "B1" AND


PAY = "1" THEN

PRICE = 1.0 3.0

NO
PRINT
INSUFFICIENT,
PLEASE ADD
ANOTHER RM2

PRINT
PRICE

IF ITEM = "A9" AND


PAY = "1" THEN

YES

PRICE = 5.0 1.0

PRINT
PRICE

IF ITEM = "B1" AND


PAY = "2" THEN

YES

PRICE = 2.0 3.0

NO

YES

PRICE = 3.0 3.0

IF ITEM = "B1" AND


PAY = "3" THEN

NO

IF ITEM = "B1" AND


PAY = "5" THEN

PRINT
PRICE

NO

YES

IF ITEM = "B2" AND


PAY = "1" THEN

PRICE = 1.0 3.0


NO
PRINT
INSUFFICIENT,
PLEASE ADD
ANOTHER RM2

PRINT
INSUFFICIENT,
PLEASE ADD
ANOTHER RM1

YES

PRICE = 5.0 1.0

PRINT
PRICE

IF ITEM = "B2" AND


PAY = "2" THEN

YES

PRICE = 2.0 3.0

NO

YES

PRICE = 3.0 3.0

IF ITEM = "B2" AND


PAY = "3" THEN

NO

IF ITEM = "B2" AND


PAY = "5" THEN

PRINT
PRICE

NO

YES

IF ITEM = "B3" AND


PAY = "1" THEN

PRICE = 1.0 3.0


NO
PRINT
INSUFFICIENT,
PLEASE ADD
ANOTHER RM2

PRINT
INSUFFICIENT,
PLEASE ADD
ANOTHER RM1

YES

PRICE = 5.0 1.0

PRINT
PRICE

IF ITEM = "B3" AND


PAY = "2" THEN

YES

PRICE = 2.0 3.0

NO

YES

PRICE = 3.0 3.0

IF ITEM = "B3" AND


PAY = "3" THEN

NO

IF ITEM = "B3" AND


PAY = "5" THEN

PRINT
PRICE

NO

YES

IF ITEM = "B4" AND


PAY = "1" THEN

PRICE = 1.0 3.0


NO
PRINT
INSUFFICIENT,
PLEASE ADD
ANOTHER RM2

PRINT
INSUFFICIENT,
PLEASE ADD
ANOTHER RM1

YES

PRICE = 5.0 1.0

PRINT
PRICE

IF ITEM = "B4" AND


PAY = "2" THEN

YES

PRICE = 2.0 3.0

NO

YES

PRICE = 3.0 3.0

IF ITEM = "B4" AND


PAY = "3" THEN

NO

IF ITEM = "B4" AND


PAY = "5" THEN

PRINT
PRICE

NO

YES

IF ITEM = "B5" AND


PAY = "1" THEN

PRICE = 1.0 3.0


NO
PRINT
INSUFFICIENT,
PLEASE ADD
ANOTHER RM2

PRINT
INSUFFICIENT,
PLEASE ADD
ANOTHER RM1

YES

PRICE = 5.0 1.0

PRINT
PRICE

IF ITEM = "B5" AND


PAY = "2" THEN

YES

PRICE = 2.0 3.0

NO

YES

PRICE = 3.0 3.0

IF ITEM = "B5" AND


PAY = "3" THEN

NO

IF ITEM = "B5" AND


PAY = "5" THEN

PRINT
PRICE

NO

YES

IF ITEM = "B5" AND


PAY = "1" THEN

PRICE = 1.0 3.0


NO
PRINT
INSUFFICIENT,
PLEASE ADD
ANOTHER RM2

PRINT
INSUFFICIENT,
PLEASE ADD
ANOTHER RM1

YES

PRICE = 5.0 1.0

PRINT
PRICE

IF ITEM = "B5" AND


PAY = "2" THEN

YES

PRICE = 2.0 3.0

NO

YES

PRICE = 3.0 3.0

NO

IF ITEM = "B5" AND


PAY = "5" THEN

PRINT
PRICE

NO

YES

IF ITEM = "B6" AND


PAY = "1" THEN

PRICE = 1.0 3.0


NO
PRINT
INSUFFICIENT,
PLEASE ADD
ANOTHER RM2

PRINT
INSUFFICIENT,
PLEASE ADD
ANOTHER
RM1

IF ITEM = "B5" AND


PAY = "3" THEN

YES

PRICE = 5.0 1.0

PRINT
PRICE

IF ITEM = "B6" AND


PAY = "2" THEN

YES

PRICE = 2.0 3.0

NO

YES

PRICE = 3.0 3.0

IF ITEM = "B6" AND


PAY = "3" THEN

NO

IF ITEM = "B6" AND


PAY = "5" THEN

PRINT
PRICE

NO

YES

IF ITEM = "C1" AND


PAY = "1" THEN

PRICE = 1.0 2.0


NO
PRINT
INSUFFICIENT,
PLEASE ADD
ANOTHER RM1

PRINT
INSUFFICIENT,
PLEASE ADD
ANOTHER RM1

YES

PRICE = 5.0 1.0

PRINT
PRICE

IF ITEM = "C1" AND


PAY = "2" THEN

YES

PRICE = 2.0 2.0

NO

YES

PRICE = 5.0 2.0

NO

IF ITEM = "C2" AND


PAY = "1" THEN

PRINT
PRICE

NO

YES

IF ITEM = "C2" AND


PAY = "2" THEN

PRICE = 2.0 2.0


NO
PRINT PRICE

PRINT PRICE

IF ITEM = "C1" AND


PAY = "5" THEN

YES

PRICE = 1.0 2.0

PRINT
INSUFFICIENT,
PLEASE ADD
ANOTHER RM1

IF ITEM = "C2" AND


PAY = "5" THEN

YES

PRICE = 5.0 2.0

NO

YES

PRICE = 1.0 2.0

IF ITEM = "C3" AND


PAY = "1" THEN

NO

IF ITEM = "C3" AND


PAY = "2" THEN

PRINT
INSUFFICIENT
, PLEASE ADD
ANOTHER
RM1

NO

YES

IF ITEM = "C3" AND


PAY = "5" THEN

PRICE = 5.0 2.0


NO
PRINT
PRICE

PRINT
PRICE

YES

PRICE = 2.0 2.0

PRINT
PRICE

IF ITEM = "C4" AND


PAY = "1" THEN

YES

PRICE = 1.0 2.0

NO

YES

PRICE = 2.0 2.0

NO

IF ITEM = "C4" AND


PAY = "5" THEN

PRINT
PRICE

NO

YES

IF ITEM = "C5" AND


PAY = "1" THEN

PRICE = 1.0 2.0


NO
PRINT
INSUFFICIENT,
PLEASE ADD
ANOTHER RM1

PRINT
INSUFFICIENT,
PLEASE ADD
ANOTHER RM1

IF ITEM = "C4" AND


PAY = "2" THEN

YES

PRICE = 2.0 2.0

PRINT
PRICE

IF ITEM = "C5" AND


PAY = "2" THEN

PRICE = 2.0 2.0

NO

YES

PRICE = 5.0 2.0

PRINT
PRICE

YES

IF ITEM = "C5" AND


PAY = "5" THEN

NO
PRINT INVALID
ITEMPLEASE PUT THE
CORRECT ITEM CODE

END

PRINT
PRICE

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

Vous aimerez peut-être aussi