Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I WANT THIS CODE ONLY IN VISUAL BASIC. A movie theater keeps only a percentage o

ID: 3717598 • Letter: I

Question

I WANT THIS CODE ONLY IN VISUAL BASIC.

A movie theater keeps only 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:

1. Gross revenue for adult tickets sold. This is the amount of money taken in for all adult tickets sold.

2. Net revenue for adult tickets sold. This is the amount of money from adult ticket sales left over after the payment to the movie company has been deducted.

3. Gross revenue for child tickets sold. This is the amount of money taken in for all child tickets sold.

4. Net revenue for child tickets sold. This is the amount of money from child ticket sales left over after the payment to the movie company has been deducted.

5. Total gross revenue. This is the sum of gross revenue for adult and child tickets sold.

6. Total net revenue. This is the sum of net revenue for adult and child tickets sold.

The application’s form should resemble the one shown below:

Protect your code from illegal or improper user input by using one or more Try...Catch blocks.

Output in the labels should be formatted as currency. Use the FormatCurrency() function.

Assume the theater keeps 20% or its box office receipts. Use a named constant in your code to represent this percentage. Use the following test data to determine if the application is calculating properly:

Ticket Sales

Price per Adult Ticket:

$6.00

Adult Tickets Sold:

120

Price per Child Ticket:

$4.00

Child Tickets Sold:

72

Revenue

Gross Adult Ticket Sales:

$720.00

Gross Child Ticket Sales:

$288.00

Total Gross Revenue:

$1,008.00

Net Adult Ticket Sales:

$144.00

Net Child Ticket Sales:

$57.60

Total Net Revenue:

$201.60

Ticket Sales

Price per Adult Ticket:

$6.00

Adult Tickets Sold:

120

Price per Child Ticket:

$4.00

Child Tickets Sold:

72

Revenue

Gross Adult Ticket Sales:

$720.00

Gross Child Ticket Sales:

$288.00

Total Gross Revenue:

$1,008.00

Net Adult Ticket Sales:

$144.00

Net Child Ticket Sales:

$57.60

Total Net Revenue:

$201.60

Theater Revenue Adult Ticket Sales Child Ticket Sales Price Per Ticket: Price Per Ticket: Tickets Sold: Tickets Sold: Gross Ticket Revenue Adult Ticket Sales: Child Ticket Sales: Net Ticket Revenue Adult Ticket Sales: Child Ticket Sales: Total Gross Revenue for Ticket Total Net Revenue for Ticket Sales: Calculate Ticket Revenue Clear lxit

Explanation / Answer

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim decAdultGTR As Decimal

        Dim decChildGTR As Decimal

        Dim decTotalGTR As Decimal

        Dim decAdultNTR As Decimal

        Dim decChildNTR As Decimal

        Dim decTotalNetGTR As Decimal

        Dim decpercentage As Decimal = 0.2

        txtAdultGTR.Enabled = True

        txtChildTicketGTR.Enabled = True

        txtTotalGrossGTR.Enabled = True

        txtAdultTicketNTR.Enabled = True

        txtChildTicketNTR.Enabled = True

        txtAdultGTR.Enabled = True

        Try

            decAdultGTR = CDec(txtPriceATS.Text) * CDec(txtTicketSoldATS.Text)

            txtAdultGTR.Text = decAdultGTR.ToString("c2")

            decChildGTR = CDec(txtPriceCTS.Text) * CDec(txtTicketSoldCTS.Text)

            txtChildTicketGTR.Text = decChildGTR.ToString("c2")

            decTotalGTR = decAdultGTR + decChildGTR

            txtTotalGrossGTR.Text = decTotalGTR.ToString("c2")

            decAdultNTR = CDec(txtAdultGTR.Text) * decpercentage

            txtAdultTicketNTR.Text = decAdultNTR.ToString("c2")

            decChildNTR = CDec(txtChildTicketGTR.Text) * decpercentage

            txtChildTicketNTR.Text = decChildNTR.ToString("c2")

            decTotalNetGTR = decAdultNTR + decChildNTR

            txtTotalNetRevNTR.Text = decTotalNetGTR.ToString("c2")

        Catch ex As Exception

            MessageBox.Show("All values must be Numeric")

        End Try

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        txtPriceATS.Clear()

        txtTicketSoldATS.Clear()

        txtPriceCTS.Clear()

        txtTicketSoldCTS.Clear()

        txtAdultGTR.Clear()

        txtChildTicketGTR.Clear()

        txtTotalGrossGTR.Clear()

        txtAdultTicketNTR.Clear()

        txtChildTicketNTR.Clear()

        txtTotalNetRevNTR.Clear()

        txtPriceATS.Focus()

    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

        Me.Close()

    End Sub

End Class