Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import javax.swing.JOptionPane;

public class Main {

    public static void main(String[] args) {
        String[] possibilities = { "Adult Ticket", "Childs Ticket", "Over Fifty Ticket" };
        String s = (String) JOptionPane.showInputDialog(null, "What ticket would you like to buy?", "Ticket Dialog",
                JOptionPane.PLAIN_MESSAGE, null, possibilities, possibilities[0]);
        switch (s) {
        case "Adult Ticket":
            System.out.println("Buy Adult");
            break;
        case "Childs Ticket":
            System.out.println("Child Adult");
            break;
        case "Over Fifty Ticket":
            System.out.println("Over Fifty Adult");
            break;
        }
    }
}