Question

Criven products in a vending machine (Tahle and their respective prices (Table 2), develop VBA ende that would undertake the

please help me ASAP ...l need a code yoour

l MTN-SA 17:01 Tinashe CIVN1006A Project Brief vii. Determine (and inform the customer) if change for the selected product is

Criven products in a vending machine (Tahle and their respective prices (Table 2), develop VBA ende that would undertake the

Criven products in a vending machine (Tahle and their respective prices (Table 2), develop VBA ende that would undertake the tollowing tasks after the customer clicks the 'purchase a producibttn: u. Tutheじustomer: i. Reive the custum' selcted product codu ii. Cunlim and display the customer's selected pruduct und product price. iii. Roccive the customer's moncy which may be input in onc or morc of the prescrihed denominations (Tahle 3). iv. Flag any input error. ag any processing error Determine (and inform theじustomer) if Lhe selected pruduct is unavailable. If unavailable, another product may be selected. vi. vii. Determine and inform the customer) if change for the selected prnduct is unavailahle. If unavailahle, another product may be selected. viii. Prevent (und infurrrı) the customer fruln receivin,เน pruduct if the total of the munies input by the customer is less than the selected product price Disnense the selected prnduct without change if the total nf the monies input hy the customer is equal to the product prioe nr dispense the product with the correct change in specitied denominations shonld the total uf the munies input by he custer be more han the product price ix. h. To the owner of the vending machine: x. Culculate ad display the change in the dilferent otry denominatios remaining in the machine. xi. Culculate and display the quantity of euch pruduct remaining in the mauhine. fx3 marks) dditional information: Harduupy alguritm. Bonus marks (e.g. efficiency of VBA code, se of comments, user-fricndlincss....) The vending machine products and monies for change are refreshed at the same time weekly There are 10 uf each product within the vending mahine immediately after refreshing. 3 marksi 2 marks Table 1. Products and product codes Simba cheese und onion Product cnde: 11 Doritns Product cude: 21 Snickers Product cnde: 31 Coca-Cola Product Lucie: 41 Simba Nik Nuks Product cnde: 12 Fet sum mor Product ude: 22 Bar Onじ Product cnde: 32 BonAqua Product we: 42 Fritos cum chips Product cnde: 13 Product code: 14 Lu Diddle Daddle Product cude: 23 | Pruduut code: 24 Product code: 33 Product code: 34 ProductじUde: 43 | Prud uut code: 44 Kit Kat Lunch Bar Fanta Cirape Twist Table 2. Prices R 10.00 R 10.00 R 10.00 R 15.00 R 10.00 R 5.00 R 10.00 R 10.00 R 10.00 R 5.00 R 10.00 R 15.00 R 10.00 R 10.00 R 10.00 R 15.00 . The vending muchine will unly ixept the following denominations: R20, R10. R5, R2 and R1 .Mnies accepted for nurchaseswl not he added to the monies allocated for change. Immediately alter refreshing. the vending machine has the following quantities uf each munetary denumination for change Tuble 3)
l MTN-SA 17:01 Tinashe CIVN1006A Project Brief vii. Determine (and inform the customer) if change for the selected product is unavailable, If unavailable, another product may be selected. vii. Prevent (and inform) the customer from receiving a product if the total of the monies input by the customer is less than the selected product price. Dispense the selected product without change if the total of the monies input by the customer is equal to the product price or dispense the product with the correct change in specified denominations should the total of the monies input by the customer be more than the product price ix. v +vi + vii 6 marks b. To the owner of the vending machine: x. Calculate and display the change in the different monetary denominations remaining in the machine. xi. Calculate and display the quantity of each product remaining in the machine x +xi3 marks Hardcopy algorithm. .Bonus marks (e.g. efficiency of VBA code, use of comments, user-friendliness..) 3 marks /2 marks) The vending machine products and monies for change are refreshed at the same time weekly . There are 10 of each product within the vending machine immediately after refreshing Table 1. Products and product codes Simba cheese and onion Product code: 11 Doritos Product code: 21 Snickers Product code: 31 Coca-Cola Product code: 41 Simba Nik Naks Product code: 12 Eet sum mor Product code: 22 Bar One Product code: 32 Fritos corn chips Product code: 13 Product code: 14 Product code: 23 Product code: 24 Product code: 33 Product code: 34 Product code: 43 Product code: 44 Diddle Daddle Kit Kat Fanta Grape Lays Oreo Lunch Bar Twist Product code: 42 Table 2. Prices R 10.00 R 10.00 R 10.00 R 15.00 R 10.00 R 5.00 R 10.00 R 10.00 R 10.00 R 5.00 R 10.00 R 15.00 R 10.00 R 10.00 R 10.00 R 15.00 The vending machine will only accept the following denominations: R20, R10, R5, R2 and Rl Monies accepted for purchases will not be added to the monies allocated for change. Immediately after refreshing, the vending machine has the following quantities of each monetary denomination for change (Table 3 . Table 3. Change in the vending machine immediately after refreshing Denomination R 10.00R 5.00 R 2.00 R 1.00 Total number 50 50 75 100
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer: See the code below:

1. VendingMachineForm.Designer.vb: System generated class. Don't modify

------------------------.

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class VendingMachine
Inherits System.Windows.Forms.Form

'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.ProductLabel = New System.Windows.Forms.Label()
Me.ProductComboBox = New System.Windows.Forms.ComboBox()
Me.PurchaseProductButton = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'ProductLabel
'
Me.ProductLabel.AutoSize = True
Me.ProductLabel.Location = New System.Drawing.Point(33, 33)
Me.ProductLabel.Name = "ProductLabel"
Me.ProductLabel.Size = New System.Drawing.Size(77, 13)
Me.ProductLabel.TabIndex = 0
Me.ProductLabel.Text = "Select Product"
'
'ProductComboBox
'
Me.ProductComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.ProductComboBox.FormattingEnabled = True
Me.ProductComboBox.Items.AddRange(New Object() {"Simba cheese and onion", "Simba Nik Naks", "Fritos corn chips", "Lays", "Doritos", "Fet sum mor", "Diddle Daddle", "Oreo", "Snickers", "Bar One", "Kit Kat", "Lunch Bar", "Coca-cola", "Bon Aqua", "Fanta Grape", "Twist"})
Me.ProductComboBox.Location = New System.Drawing.Point(128, 34)
Me.ProductComboBox.Name = "ProductComboBox"
Me.ProductComboBox.Size = New System.Drawing.Size(121, 21)
Me.ProductComboBox.TabIndex = 1
'
'PurchaseProductButton
'
Me.PurchaseProductButton.Location = New System.Drawing.Point(130, 81)
Me.PurchaseProductButton.Name = "PurchaseProductButton"
Me.PurchaseProductButton.Size = New System.Drawing.Size(119, 23)
Me.PurchaseProductButton.TabIndex = 2
Me.PurchaseProductButton.Text = "Purchase a Product"
Me.PurchaseProductButton.UseVisualStyleBackColor = True
'
'VendingMachine
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(354, 273)
Me.Controls.Add(Me.PurchaseProductButton)
Me.Controls.Add(Me.ProductComboBox)
Me.Controls.Add(Me.ProductLabel)
Me.Name = "VendingMachine"
Me.Text = "Vending Machine"
Me.ResumeLayout(False)
Me.PerformLayout()

End Sub

Friend WithEvents ProductLabel As Label
Friend WithEvents ProductComboBox As ComboBox
Friend WithEvents PurchaseProductButton As Button
End Class

---------------------------------------

2. VendingMachineForm.vb: User class. Write all your code in this class.

--------------------------------

Public Class VendingMachine
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles PurchaseProductButton.Click
Dim ProductCodes = New Integer() {11, 12, 13, 14, 21, 22, 23, 24, 31, 32, 33, 34, 41, 42, 43, 44}
Dim ProductPrices = New Double() {10.0, 10.0, 10.0, 10.0, 10.0, 5.0, 5.0, 10.0, 10.0, 10.0, 10.0, 10.0, 15.0, 10.0, 15.0, 15.0}
Dim SelectedProductIndex As Integer
SelectedProductIndex = ProductComboBox.SelectedIndex
If Not (SelectedProductIndex > -1) Then
MsgBox("No Product selected. Please try again.")
Else
Dim SelectedProduct As String
SelectedProduct = ProductComboBox.SelectedItem
Dim MsgToShow = "Selected Product: " & SelectedProduct & ", Price: R " & ProductPrices(SelectedProductIndex)
MsgBox(MsgToShow)
End If
End Sub
End Class
---------------------------------

Add a comment
Know the answer?
Add Answer to:
Criven products in a vending machine (Tahle and their respective prices (Table 2), develop VBA en...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Please guys l need a code ASAP which runs not tips ...l need to submit my assignment as soon as p...

    please guys l need a code ASAP which runs not tips ...l need to submit my assignment as soon as possible... please help VBA simple code Criven products in a vending machine (Tahle and their respective prices (Table 2), develop VBA ende that would undertake the tollowing tasks after the customer clicks the 'purchase a producibttn: u. Tutheじustomer: i. Reive the custum' selcted product codu ii. Cunlim and display the customer's selected pruduct und product price. iii. Roccive the customer's...

  • 1. Create a new multi-class Java program which implements a vending machine simulator which contains the...

    1. Create a new multi-class Java program which implements a vending machine simulator which contains the following functionality: A) At program startup, the vending machine is loaded with a variety of products in a variety of packaging for example soda/tonic/Coke in bottles, peanuts in bags, juice in cartons, etc. Also included is the cost of each item. The program should be designed to easily load a different set of products easily (for example, from a file). Also at program startup,...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT