Im getting 21 error codes using text pad. Im not sure whats wrong here? Im using
ID: 3527143 • Letter: I
Question
Im getting 21 error codes using text pad. Im not sure whats wrong here? Im using the newest Text pad to write all my programs. Why is it when i try and compile it, it's filled with errors?
import javax.swing.JOptionPane;
public class CH3EX4
{
public static void main(String[] args)
{
String inputStr;
String outputStr;
int noOfTicketsSoldBox;
int noOfTicketsSoldSideline;
int noOfTicketsSoldPremium;
int noOfTicketsSoldGeneral;
double totalBoxSaleAmount;
double totalSidelineSaleAmount;
double totalPremiumSaleAmount;
double totalGeneralSaleAmount;
inputStr = JOptionPane. showInputDialog
("Enter the total number of tickets sold for Box Admission")
noOfBoxTicketsSold= Integer.parseInt(inputStr);
inputStr = JOptionPane. showInputDialog
("Enter the total number of tickets sold for Sideline Admission")
noOfSidelineTicketsSold = Integer.parseInt(inputStr);
inputStr = JOptionPane. showInputDialog
("Enter the total number of tickets sold for Premium Admission")
noOfPremiumTicketsSold = Integer.parseInt(inputStr);
inputStr = JOptionPane. showInputDialog
("Enter the total number of tickets sold for General Admission")
noOfGeneralTicketsSold = Integer.parseInt(inputStr);
totalBoxSaleAmount = noOfBoxTicketsSold * 250;
totalSidelineSaleAmount = noOfSidelineTicketsSold * 100;
totalPremiumSaleAmount = noOfPremiumTicketsSold * 50;
totalSidelineSaleAmount = noOfGeneralTicketsSold * 25;
outputStr = "Number Of Box Tickets Sold: "
+ (noOfBoxTicketsSold) + " "
+ Box Total: $"
+ String.format("%.2f", totalBoxSaleAmount) + " "
+ "Number Of Sideline Tickets Sold: "
+ (noOfSidelineTicketsSold) + " "
+ Sideline Total: $"
+ String.format("%.2f", totalSidelineSaleAmount) + " "
+ "Number Of Premium Tickets Sold: "
+ (noOfPremiumTicketsSold) + " "
+ Premium Total: $"
+ String.format("%.2f", totalPremiumSaleAmount) + " "
+ "Number Of General Tickets Sold: "
+ (noOfGeneralTicketsSold + " "
+ General Total: $"
+ String.format("%.2f", totalGeneralSaleAmount) + " "
JOptionPane.showMessageDialog(null, outputStr,
"Total Ticket Sales",
JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
}
}
Explanation / Answer
www.actionscript.org/forums/archive/index.php3/t-54018.html