Assignment 11

import javax.swing.JOptionPane; 

class MovieTickets
{
    public static void main (String[] args)
    {
    String
    //letter or # to be input
    inputMovie, inputChild, inputAdult, inputSenior;
    int
    //conversion numbers
    ticketChild, ticketAdult, ticketSenior,
    price,
    //Ticket Prices
    adult = 13, child = 6, senior = 13;
    String
    //the movie choices
    movieA = "A" ,  movieB = "B" ,  movieC = "C",  movieD = "D",  movieE = "E";
    
      JOptionPane.showMessageDialog(
           null, "Hello and welcome to MovieTickets.com!", "Welcome!",
           JOptionPane.PLAIN_MESSAGE);
           
 inputMovie = JOptionPane.showInputDialog("Which movie would you like to buy tickets to?" + "\n" +
"A= Kangaroo Jack" + "\n" +
"B= A Guy Thing" + "\n" +
"C= The Lord of the Rings: The Two Towers" + "\n" +
"D= Narc" + "\n" +
"E= Antwone Fisher" );
    
    if (inputMovie.equals(movieA))
    {
    inputChild = JOptionPane.showInputDialog("How many children tickets would you like to buy for 'Kangaroo Jack'?" );
    inputAdult = JOptionPane.showInputDialog("How many adult tickets would you like to buy for 'Kangaroo Jack'?" );
    inputSenior = JOptionPane.showInputDialog("How many senior tickets would you like to buy for' Kangaroo Jack'?" );
    }
    else if (inputMovie.equals(movieB))
    {
    inputChild = JOptionPane.showInputDialog("How many children tickets would you like to buy for 'A Guy Thing'?" );
    inputAdult = JOptionPane.showInputDialog("How many adult tickets would you like to buy for 'A Guy Thing'?" );
    inputSenior = JOptionPane.showInputDialog("How many senior tickets would you like to buy for 'A Guy Thing'?" );
    }
    else if (inputMovie.equals(movieC))
       {
    inputChild = JOptionPane.showInputDialog("How many children tickets would you like to buy for 'The Lord of the Rings: The Two Towers'?" );
    inputAdult = JOptionPane.showInputDialog("How many adult tickets would you like to buy for 'The Lord of the Rings: The Two Towers'?" );
    inputSenior = JOptionPane.showInputDialog("How many senior tickets would you like to buy for 'The Lord of the Rings: The Two Towers'?" );
    }
    else if (inputMovie.equals(movieD))
       {
        JOptionPane.showMessageDialog(
           null, "This movie is rated R.", "Warning",
           JOptionPane.PLAIN_MESSAGE);
    inputChild = JOptionPane.showInputDialog("How many children tickets would you like to buy for 'Narc'?" );
    inputAdult = JOptionPane.showInputDialog("How many adult tickets would you like to buy for 'Narc'?" );
    inputSenior = JOptionPane.showInputDialog("How many senior tickets would you like to buy for 'Narc'?" );
    }
      else if (inputMovie.equals(movieE))
       {
    inputChild = JOptionPane.showInputDialog("How many children tickets would you like to buy for 'Antwone Fisher'?" );
    inputAdult = JOptionPane.showInputDialog("How many adult tickets would you like to buy for 'Antwone Fisher'?" );
    inputSenior = JOptionPane.showInputDialog("How many senior tickets would you like to buy for 'Antwone Fisher'?" );
    }
    else 
    {inputChild = "0";
    inputAdult = "0";
    inputSenior = "0";
}    
    
      ticketChild = Integer.parseInt(inputChild);
      ticketAdult = Integer.parseInt(inputAdult);
      ticketSenior = Integer.parseInt(inputSenior);
      price = ((ticketChild * child) + (ticketAdult + adult) + (ticketSenior * senior));
    
     JOptionPane.showMessageDialog(
           null, "Your have purchased: " + "\n" + ticketChild + " children tickets" + "\n" +
            ticketAdult + " adult tickets" + "\n" +
            ticketSenior + " senior tickets" + "\n" +
            "Your total comes to: $" + price , "Bill",
           JOptionPane.PLAIN_MESSAGE);
           
           System.exit(0); 
           
      }
}



Hosted by www.Geocities.ws

1