2013-09-21 08:41:51 UTC
A movie theater only keeps a percentage of the revenue earned from ticket
sales. The remainder goes to the movie company. Create an application that
calculates and displays the following figures for one night's box office
business at a theater:
Gross revenue for adult tickets sold. (Amount of money taken in for all
adult tickets sold)
Net revenue for adult tickets sold. (Amount of money left over after payment
to movie company)
Gross revenue for child tickets sold. (Amount of money taken in for all
child tickets sold)
Net revenue for child tickets sold. (Amount of money left over after payment
to movie company)
Total gross revenue. (Sum of child and adult gross)
Total net revenue. (Sum of child and adult net)
Assume the theater keeps 20% of its box office receipts. Use A named constant in the code to represent this percentage.
This is what I have so far:
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
' Declare variable for the calculations.
Dim decAdultPrice As Decimal ' Price per adult ticket
Dim decAdultSold As Integer ' Number of adult tickets sold
Dim decTotalGrossAdult As Decimal
Dim decChildPrice As Decimal ' Price per child ticket
Dim decChildSold As Integer
Dim decTotalGrossChild As Decimal ' Number of child tickets sold
Dim decTotalGross As Decimal
Const decREVEUNE As Decimal = CDec(0.2) '
' Adult Calculations
' Declare variables for the calculations.
Dim decAdultPrice = Val(txtAdultTicket.Text)
Dim decAdultSold = Val(txtAdultSold.Text)
Dim decTotalGrossAdult = decAdultPrice * decAdultSold
lblGrossAdult.Text = decTotalGrossAdult.ToString("$ ##.00")
' Child Calculations
decChildPrice = Val(txtChildTicket.Text)
decChildSold = Val(txtChildSold.Text)
decTotalGrossChild = decChildPrice * decChildSold
lblGrossChild.Text = decTotalGrossChild.ToString("$ ##.00")
' Total Calculations
decTotalGross = decTotalGrossAdult + decTotalGrossChild
lblTotalGross.Text = decTotalGross.ToString("$ ##.00")
Dim decTotalNetAdult As Double
Dim decTotalNetChild As Double
Dim decTotalNet As Double
' Adult Net Calculations
decTotalNetAdult = decTotalGrossAdult * decREVEUNE
lblNetAdult.Text = decTotalNetAdult.ToString("$ ##.00")
' Child Net Calculations
decTotalNetChild = decTotalGrossChild * decREVEUNE
lblNetChild.Text = decTotalNeChild.ToString("$ ##.00")
' Total Calclations
decTotalNet = decTotalNetGrossAdult + decTotalNetGrossChild
lblTotalNet.Text = decTotalNet.ToString("$ ##.00")
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles btnClear.Click
' Clear the adult ticket sales.
txtAdultPricePerTicket.Clear()
txtAdultTicketsSold.Clear()
' Clear the child ticket sales.
txtChildPricePerTicket.Clear()
txtChildTicketsSold.Clear()
' Clear the decTotal fields.
lblGrossAdultTicketSales.Text = String.Empty
lblGrossChildTicketSales.Text = String.Empty
lblTotalGrossRevenue.Text = String.Empty
lblNetAdultTicketSales.Text = String.Empty
lblNetChildTicketSales.Text = String.Empty
lblTotalNetRevenue.Text = String.Empty
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
' Close the form.
Me.Close()
End Sub
End Class