- Edited
My first topic wasn't quite clear so i'm gonna explain it better this time..
I have a visual basic project to do.
I must program a cash register, that takes in how much a customer must pay and how much he payed. Then display the difference between them. For exemple, if a customer must pay 14250 and he payed 15000 then it must display 750
So far i have no problem but now comes the tricky part for me. The cash register must also display on start up the type of bills that are in the register, like 50 000 L.L, 20 000 L.L etc.. And also display their quantity ex : 30 * 50 000 L.L.
The bills in the register are (from exercise question):50 000 * 30, 20 000 * 5, 10 000*10, 5000 * 10 , 1000 * 100, 500 * 100, 250 * 100, 100* 100.
I return to the exemple above, if the customer payed 15000 then the cashier must pay him back 750 from the bills in the register and the quantity of the bills must decrease to show it. The cashier pays him back with a bill from 500 and a bill from 250 while their quantity decreases minus 1.
This is what i have come up with so far:
I also have no idea how i am gonna write the give money back code..
If anyone can help it will be great.
I have a visual basic project to do.
I must program a cash register, that takes in how much a customer must pay and how much he payed. Then display the difference between them. For exemple, if a customer must pay 14250 and he payed 15000 then it must display 750
So far i have no problem but now comes the tricky part for me. The cash register must also display on start up the type of bills that are in the register, like 50 000 L.L, 20 000 L.L etc.. And also display their quantity ex : 30 * 50 000 L.L.
The bills in the register are (from exercise question):50 000 * 30, 20 000 * 5, 10 000*10, 5000 * 10 , 1000 * 100, 500 * 100, 250 * 100, 100* 100.
I return to the exemple above, if the customer payed 15000 then the cashier must pay him back 750 from the bills in the register and the quantity of the bills must decrease to show it. The cashier pays him back with a bill from 500 and a bill from 250 while their quantity decreases minus 1.
This is what i have come up with so far:
Public Class Form1
Dim money(8), qty(8) As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
display()
money(1) = 50000
qty(1) = 30
money(2) = 20000
qty(2) = 5
money(3) = 10000
qty(3) = 10
money(4) = 5000
qty(4) = 10
money(5) = 1000
qty(5) = 100
money(6) = 500
qty(6) = 100
money(7) = 250
qty(7) = 100
money(8) = 100
qty(8) = 100
Label3.Text = ""
End Sub
Private Sub display()
Dim i As Integer
money(1) = 50000
qty(1) = 30
money(2) = 20000
qty(2) = 5
money(3) = 10000
qty(3) = 10
money(4) = 5000
qty(4) = 10
money(5) = 1000
qty(5) = 100
money(6) = 500
qty(6) = 100
money(7) = 250
qty(7) = 100
money(8) = 100
qty(8) = 100
For i = 0 To 7
Label4.Text = Label4.Text & money(i) & vbTab & " * " & qty(i) & vbCrLf
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim moneyin, moneyout, result, i As Integer
moneyin = TextBox1.Text
moneyout = TextBox2.Text
result = moneyout - moneyin
Label3.Text = Label3.Text & result
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Label3.Text = ""
money(1) = 50000
qty(1) = 30
money(2) = 20000
qty(2) = 5
money(3) = 10000
qty(3) = 10
money(4) = 5000
qty(4) = 10
money(5) = 1000
qty(5) = 100
money(6) = 500
qty(6) = 100
money(7) = 250
qty(7) = 100
money(8) = 100
qty(8) = 100
End Sub
End class
I made an array for both the money bills and quantity but i am unsure if that's how it must be done.I also have no idea how i am gonna write the give money back code..
If anyone can help it will be great.