Question
This is java question the class should be called theaterrevenue.java theater revenue a movie ... Your question has been answered Let us know if you
This is java question the class should be called theaterrevenue.java theater revenue a movie ... Your question has been answered Let us know if you got a helpful answer. Rate this answer Question: This is Java Question The class should be called TheaterRevenue.java Theater Revenue A movie thea... This is Java Question The class should be called TheaterRevenue.java 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 nights 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 have this code but is not Compile somebody tried to help but when I tried is not working
import javax.swing.*; import java.awt.*;
import java.awt.event.*;
public class GUIRevenueTheater extends JFrame {
final double percentage = .20;
double adultprice;
private JTextField k1;
private JTextField k2;
private JTextField k3;
private JTextField k4;
private JButton butt;
private final int guiwidthi = 400;
private final int guiheight = 200;
public GUIRevenueTheater() {
setTitle("Theater Revenue");
setSize(guiwidthi, guiheight);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(new GridLayout(5,2));
butt = new JButton("Calculation Revenue process");
butt.addActionListener(new revenuecalc());
JLabel 111 = new JLabel("price per adult ticket:");
k1 = new JTextField(10);
JLabel 112 = new JLabel("Numb of adult person tickets sold:");
k2 = new JTextField(10);
JLabel 113 = new JLabel("cost per child ticket:");
k3 = new JTextField(10);
JLabel 114 = JLabel("Numb of child person tickets sold:");
k4 = new JTextField(10);
JPanel p1 = new JPanel();
JPanel p2 = new JPanel();
JPanel p3 = new JPanel();
JPanel p4 = new JPanel();
JPanel p5 = new JPanel();
JPanel p6 = new JPanel();
JPanel p7 = new JPanel();
JPanel p8 = new JPanel();
JPanel p9 = new JPanel();
p1.add(111); p2.add(k1);
p3.add(112); p4.add(k2);
p5.add(113); p6.add(k3);
p7.add(114); p8.add(k4);
p9.add(butt); add(p1);
add(p2); add(p3);
add(p4); add(p5);
add(p6); add(p7);
add(p8); add(p9);
setVisible(true); }
private class revenuecalc implements ActionListener
{
public void actionPerformed(ActionEvent e) {
String priceticketadultperson;
String soldpro; String priceticketchild;
String soldc;
priceticketadultperson = k1.getText();
adultprice=Double.parseDouble(priceticketadultperson);
System.out.print("answer");
soldpro = k2.getText();
double grossA1 = (adultprice)* double.parseDouble(soldpro);
double netAvalue = (grossA1) * percentage;
priceticketchild = k3.getText();
soldc = k4.getText();
double grossC1 = Double.parseDouble (priceticketchild)* Double.parseDouble(soldc);
double netCvalue = grossC1 * percentage; double totalGrossvalue = grossC1 + grossA1;
double totalNetvalue = netAvalue + netCvalue;
JOptionPane.showMessageDialog(null, "Total gross adult revenue values: " +
grossA1 + " " + "Total net value: + netAvalue + " " + "Total gross child person value: " +
grossC1 + " " + "Total netchild value: " + netCvalue + " " + "Total gross sales: " +
totalGrossvalue + " " + Total net sales: " + totalNetvalue);
}
}
}
This again is not compile help me Itried my self I got very hard time
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started