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
Asked Jan 11, 2020
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:
� Price per adult ticket
� 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

Expert Answer

Step 1

Program:

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

 

public class Theatre extends JFrame

{

    final double percent = .20;

     double adultCost;

     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");

          calc.addActionListener(new

          CalcButtonListener());

       

          JLabel l1 = new JLabel("Price per "

                   + "adult ticket : ");

          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();

 

          panel1.add(l1);

          panel2.add(f1);

          panel3.add(l2);

          panel4.add(f2);

          panel5.add(l3);

          panel6.add(f3);

          panel7.add(l4);

          panel8.add(f4);

          panel9.add(calc);        

 

          add(panel1);

          add(panel2);

          add(panel3);

          add(panel4);

          add(panel5);

          add(panel6);

          add(panel7);

          add(panel8);

          add(panel9);

          setVisible(true);

     }

     private class CalcButtonListener implements ActionListener

     {

         public void actionPerformed(ActionEvent e)

          {

              String priceAdultTicket;

              String aSold;

              String priceChildTicket;

              String cSold;

              priceAdultTicket = f1.getText();

              adultCost = Double.parseDouble(priceAdultTicket);

 

              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:

...
Computer Science homework question answer, step 2, image 1
fullscreen

Want to see the full answer?

See Solution

Check out a sample Q&A here.

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

Engineering

Computer Science

Related Computer Science Q&A

Find answers to questions asked by student like you
Show more Q&A
add
question_answer

Q: Function decode(comm, null, 0, comm) is the same asA) NVL(comm, 0)B) decode(comm, comm, comm, 0)C) u...

A:  The function decode() work as if-then-else, the first argument is the expression or column which is...

question_answer

Q: Programming in Java. What would the difference be in the node classes for a singly linked list, doub...

A: Instructions:The node class can add two constructors for the three of them one with no augments and ...

question_answer

Q: what is the minimum possible depth of a d-ary tree

A: Click to see the answer

question_answer

Q: Write a program in Python that lets the user enter the total rainfall for each of 12 months into a l...

A: Program Instructions:Declare a list with months and use this list to get rainfall for each month.App...

question_answer

Q: Write a statement that calls the recursive function BackwardsAlphabet() with parameter startingLette...

A: Answer:The statement is used to call the recursive function “BackwardsAlphabet ()” with the “startin...

question_answer

Q: (1) Prompt the user for a title for data. Output the title. Ex: Enter a title for the data: Number o...

A: Answer 1:Source code#include <iostream>using namespace std;int main(){  string title;  cout&lt...

question_answer

Q: 1. Explain what the CPU should do when an interrupt occurs. Include in your answer the method the CP...

A: Interrupts:Interrupts are essentially events that interrupt the system's normal execution stream. Al...

question_answer

Q: If you were an IT Director, would you recommend SDN? Why or why not?

A: Software Defined Networking (SDN):The Software Defined Networking (SDN) is basically a new technolog...

question_answer

Q: Write a C++ console application that allows your user to capture rainfall statistics. Your program s...

A: The C++ program and approach are given below:Approach:Declaring the essential headers and the namesp...