# Theater RevenueA movie theater only keeps a percentage of the revenue earned from ticket sales. The remainder goes to the movie company. Create a GUI application that allows the user to enter the following data into text fields:� Price per adult ticket� Number of adult tickets sold� Price per child ticket� Number of child tickets soldThe application should calculate and display the following data for one night�s box office business at a theater:� Gross revenue for adult tickets sold. This is the amount of money taken in for all adult tickets sold.� 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.� Gross revenue for child tickets sold. This is the amount of money taken in for all child tickets sold.� 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.� Total gross revenue. This is the sum of gross revenue for adult and child tickets sold.� Total net revenue. This is the sum of net revenue for adult and child tickets sold.Assume the theater keeps 20 percent of its box office receipts. Use a constant in your code to represent this percentage. I NEED BASIC CODE THIS IS A INTRO TO JAVA CLASS!!!!!!

Question
22 views

Theater Revenue
A movie theater only keeps a percentage of the revenue earned from ticket sales. The remainder goes to the movie company. Create a GUI application that allows the user to enter the following data into text fields:
� Number of adult tickets sold
� Price per child ticket
� Number of child tickets sold
The application should calculate and display the following data for one night�s box office business at a theater:
� Gross revenue for adult tickets sold. This is the amount of money taken in for all adult tickets sold.
� 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.
� Gross revenue for child tickets sold. This is the amount of money taken in for all child tickets sold.
� 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.
� Total gross revenue. This is the sum of gross revenue for adult and child tickets sold.
� Total net revenue. This is the sum of net revenue for adult and child tickets sold.
Assume the theater keeps 20 percent of its box office receipts. Use a constant in your code to represent this percentage. I NEED BASIC CODE THIS IS A INTRO TO JAVA CLASS!!!!!!

check_circle

Step 1

Program:

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

public class Theatre extends JFrame

{

final double percent = .20;

private JTextField f1;

private JTextField f2;

private JTextField f3;

private JTextField f4;

private JButton calc;

private final int WINDOW_WIDTH = 400;

private final int WINDOW_HEIGHT = 200;

public Theatre()

{

setTitle("Theatre Revenue");

setSize(WINDOW_WIDTH, WINDOW_HEIGHT);

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

setLayout(new GridLayout(5, 2));

calc = new JButton("Calculate Revenue");

CalcButtonListener());

JLabel l1 = new JLabel("Price per "

f1 = new JTextField(10);

JLabel l2 = new JLabel("Number of "

+ "adult tickets sold : ");

f2 = new JTextField(10);

JLabel l3 = new JLabel("Price per "

+ "child ticket: ");

f3 = new JTextField(10);

JLabel l4 = new JLabel(" Number of "

+ "child tickets sold : ");

f4 = new JTextField(10);

JPanel panel1 = new JPanel();

JPanel panel2 = new JPanel();

JPanel panel3 = new JPanel();

JPanel panel4 = new JPanel();

JPanel panel5 = new JPanel();

JPanel panel6 = new JPanel();

JPanel panel7 = new JPanel();

JPanel panel8 = new JPanel();

JPanel panel9 = new JPanel();

setVisible(true);

}

private class CalcButtonListener implements ActionListener

{

public void actionPerformed(ActionEvent e)

{

String aSold;

String priceChildTicket;

String cSold;

aSold = f2.getText();

double grossA = (adultCost) * Double.parseDouble(aSold);

double netA = (grossA) * percent;

priceChildTicket = f3.getText();

cSold = f4.getText();

double grossC = Double.parseDouble

(priceChildTicket) * Double.parseDouble(cSold);

double netC = grossC * percent;

double totalGross = grossC + grossA;

double totalNet = netA + netC;

JOptionPane.showMessageDialog(null,

"Total gross adult revenue : "

+ grossA + "\n"

+ "Total net adult revenue : "

+ netA + "\n"

+ "Total gross child revenue : "

+ grossC + "\n"

+ "Total net child revenue : "

+ netC + "\n"

+ "Total gross revenue of sales : "

+ totalGross

+ "\n" + "Total net revenue of sales : "

+ totalNet);

}

}

public static void main(String[] args)

{

Theatre gui = new Theatre();

}

}

Step 2

Output:

...

### Want to see the full answer?

See Solution

#### Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in