Advertisement
Guest User

Untitled

a guest
Jun 29th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 1.06 KB | None | 0 0
  1. public static void orderTickets()
  2. {  
  3.  
  4.     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");
  5.     int ticketnum = Integer.parseInt(ordertickets);  ///------------ Changed variable name to ticketnum, as in, which ticket number
  6.  
  7.     String[] bands = {"Vampire Weekend","Of Montreal","Someone Still Loves You Boris Yeltsin"};
  8.     int[] prices = {10,8,6};
  9.  
  10.     int tickets = Integer.parseInt(JOptionPane.showInputDialog("Please type in amount of ticket."));
  11.  
  12.     if (ticketnum < bands.length) ///------------ Changed to ticketnum, which band they selected, not amount
  13.     {
  14.         int price = prices[ticketnum-1]*tickets ///--------------- calculates price, gets price of one ticket for the chosen band, multiplied by the amount wanted
  15.         JOptionPane.showMessageDialog(null, price " pounds - General Admission");
  16.     }
  17.     else
  18.     {
  19.         JOptionPane.showMessageDialog(null,"Error. Please type in the number of the group listed.");
  20.     }
  21.  
  22.     int accounts = accountNumber();
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement