ok so i have got this project due but i am not sure if i imported or even used the right form. I used the import javax.swing.JOptionPane; but im am not sure if i should have used the improt java.io and import java.util method... Im so confused on which one i am to use or if it even matters here are the instructions i was given
This lab is designed to give the student practice in the design and implementation of a program that uses Objects and file input.
Problem Description: The manager of a football stadium wants you to write a program that calculates the total ticket sales after each game. There are four types of tickets -- box, sideline, premium and general admission. After each game, the data is stored in a file in the following form:
ticketPrice numberOfTicketsSold
...
Sample data are shown below:
250 5570
100 28000
50 35750
25 18750
The first line indicates that the box ticket price is $250 and that 5,750 tickets were sold at that price.
Output a table that shows the number of tickets sold and the sales amount for each ticket type followed by a total line showing the overall number of tickets shold and overall sales amount. Sample output follows
so according to these directions what method should i have used?
and here is my program
CODE
import javax.swing.JOptionPane;
public class TicketSale
{
public static void main(String[] args)
{
String inputStr;
String outputStr;
int noOfBoxTicketsSold;
int noOfSidelineTicketsSold;
int noOfPremiumTicketsSold;
int noOfGeneralAdmissionTicketsSold;
double totalBoxSales;
double totalSidelineSales;
double totalPremiumSales;
double totalGeneralAdmissionSales;
totalBoxSales = noOfBoxTicketsSold * 250;
totalSidelineSales = noOfSidelineTicketsSold * 100
totalPremiumSales = noOfPremiumTicketsSold * 50;
totalGeneralAdmissionSales = noOfGeneralAdmissionTicketsSold * 25;
inputStr = JOptionPane. showInputDialog
("Enter the total number of tickets sold for Box Seats")
noOfBoxTicketsSold= Integer.parseInt(inputStr);
inputStr = JOptionPane. showInputDialog
("Enter the total number of tickets sold for Sideline Seats")
noOfSidelineTicketsSold = Interger.parseInt(inputStr);
inputStr = JOptionPane. showInputDialog
("Enter the total number of tickets sold for Premium Seating")
noOfPremiumSeatsSold= Integer.parseInt(inputStr);
inputStr = JOptionPane. showInputDialog
("Enter the total number of tickets sold for General Admission Seating")
noOfPremiumSeatsSold= Integer.parseInt(inputStr);
outputStr = "Number Of Box Tickets Sold: "
+ (noOfBoxTicketsSold) + "\n"
+ Box Total: $"
+ String.format("%.2f", totalBoxSales) + " \n"
+ "Number Of Sideline Tickets Sold: "
+ (noOfSidelineTicketsSold) + "\n"
+ Sideline Total: $"
+ String.format("%.2f", totalSidelineSales) + "\n"
+ "Number Of Premium Tickets Sold: "
+ (noOfPremiumTicketsSold) + "\n"
+ Premium Total: $"
+ String.format("%.2f", totalPremiumSales) + "\n"
+ "Number Of General Tickets Sold: "
+ (noOfGeneralTicketsSold + "\n"
+ General Total: $"
+ String.format("%.2f", totalGeneralAdmissionSales) + "\n"
JOptionPane.showMessageDialog(null, outputStr,
"Total Ticket Sales Data",
JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
}
}