All pastes #957683 Raw Edit

Untitled

public text v1 · immutable
#957683 ·published 2008-03-26 03:20 UTC
rendered paste body
import javax.swing.JOptionPane;
public class TicketOrder{
    public static void main(String args[]){
        int ticket_vip_price = 35;
        int ticket_deluxe_price = 25;
        int ticket_standard_price = 12;
        
        String ticket_type;
        String message="";
        int ticket_quantity;
        int totalprice=0;
         
        ticket_type = JOptionPane.showInputDialog("Choose one of these ticket types : \n- VIP\n- Deluxe\n-Standard ");
        ticket_quantity = Integer.parseInt(JOptionPane.showInputDialog("Enter the ticket quantity"));
        
        if(ticket_type=="VIP" || ticket_type == "vip"){
            totalprice = ticket_vip_price * ticket_quantity;
            message = "Ticket type : VIP Ticket";
            message += "\nPrice per ticket : " + ticket_vip_price;
        }else if(ticket_type=="DELUXE" || ticket_type == "deluxe"){
            totalprice = ticket_deluxe_price * ticket_quantity;   
            message = "Ticket type : DELUXE TicketKET";
            message += "\nPrice per ticket : " + ticket_deluxe_price;
        }else if(ticket_type=="STANDARD" || ticket_type == "standard"){
            totalprice = ticket_standard_price * ticket_quantity;  
            message = "Ticket type : STANDARD Ticket";
            message += "\nPrice per ticket : " + ticket_standard_price;
        }
        
        message+= "\nTotal price : " + totalprice;
        
        JOptionPane.showMessageDialog(null, message);
        System.exit(0);
        
    }
}