import javax.swing.JOptionPane; public class CH3EX4 { public static void main(St
ID: 3527139 • Letter: I
Question
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); } } Im getting so many error codes!I dont understand please help!Explanation / Answer
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); } }
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.