Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void orderTickets()
- {
- String ordertickets = JOptionPane.showInputDialog("Order tickets now.\nType in the number of a band\n\n 1. Vampire Weekend \n 2. Of Montreal \n 3. Someone Still Loves You Boris Yeltsin");
- int ticketnum = Integer.parseInt(ordertickets); ///------------ Changed variable name to ticketnum, as in, which ticket number
- String[] bands = {"Vampire Weekend","Of Montreal","Someone Still Loves You Boris Yeltsin"};
- int[] prices = {10,8,6};
- int tickets = Integer.parseInt(JOptionPane.showInputDialog("Please type in amount of ticket."));
- if (ticketnum < bands.length) ///------------ Changed to ticketnum, which band they selected, not amount
- {
- int price = prices[ticketnum-1]*tickets ///--------------- calculates price, gets price of one ticket for the chosen band, multiplied by the amount wanted
- JOptionPane.showMessageDialog(null, price " pounds - General Admission");
- }
- else
- {
- JOptionPane.showMessageDialog(null,"Error. Please type in the number of the group listed.");
- }
- int accounts = accountNumber();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement