Need help programming a Visual Basic project that requires the following informa
ID: 3535389 • Letter: N
Question
Need help programming a Visual Basic project that requires
the
following information/steps:
Create a Visual Basic program for a Movie theater ticket sale
kiosk.
The project should contain the following items:
A title for the form.
An object for the user to enter the number of ticket they wish
to purchase.
Error checking --- The maximum number of tickets purchased is
15. An error message should display if a number greater than 15 is
entered.
Use a radio button to select either the day or the evening
show.
Use Global Variables to represent the ticket prices. The price
of each ticket is:
$5.00 for the matinee
$7.00 for the evening show
An object to display the total price for the
tickets.
A button that the user click to calculate the total cost of the
tickets.
Code to Calculate the total cost of the
tickets.
Code that will Output the total cost of the tickets to the
user.
A second button that will be used to clear the input and output
objects.
Explanation / Answer
Well, the entire coide would take too long for us to write, but here I have written a snippet that will help you go along.
Kindly rate my efforts since it takes time to write them all :)
Code:
Option Explicit
Dim mcurGrandTotal As Currency
Dim mcurTotalPrice As Currency
Dim mintCustomerCount As Integer
Const mcurDiscount As Currency = 0.2
Private Sub cmdProcessTickets_Click()
'Calculate the prices of tickets and discount
Dim curSubTotal As Currency
Dim curDiscountPrice As Currency
Dim curAdultsPrice As Currency
Dim curChildPrice As Currency
Dim intNoOfAdults As Integer
Dim intNumberOfChildren As Integer
Const curAdultPrice As Currency = 5
Const curChildrenPrice As Currency = 3
'Enter the Screen Number
If txtEnterScreenNumber.Text = 2 Then
lblAltScreen.Caption = 2
Else
If txtEnterScreenNumber.Text = 1 Then
lblScreen.Caption = 1
End If
'Convert values to numeric
mcurTotalPrice = Val(lblTotalPrice.Caption)
curDiscountPrice = Val(lblDiscountPrice.Caption)
curAdultsPrice = Val(lblAdultsPrice.Caption)
curChildPrice = Val(lblChildPrice.Caption)
intNoOfAdults = Val(txtNoOfAdults.Text)
intNumberOfChildren = Val(txtNumberOfChildren.Text)
End If
'Calculate the prices of tickets for Screen 1 for adults and children
lblAdultsPrice.Caption = txtNoOfAdults.Text * curAdultPrice
lblChildPrice.Caption = txtNumberOfChildren.Text * curChildrenPrice
'Calculate the prices of tickets for Screen 2 for adults and children
lblAdultsPrice.Caption = curAdultPrice * txtNoOfAdults.Text
lblChildPrice.Caption = curChildrenPrice * txtNumberOfChildren.Text
mcurTotalPrice = curAdultsPrice + curChildPrice
End Sub
Cheers!
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.