SHARE
TWEET

Untitled

reyhanzo Dec 15th, 2019 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.until.Scanner ;
  2. public class IntMain
  3. {
  4.     public static void main ( String args [])
  5.     {
  6.         Scanner scan = new Scanner(System.in);
  7.         int cost, menu, balance;
  8.         System.out.println("Masukkan harga tiket \n");
  9.         cost=scan.nextInt();
  10.         TicketMachine ticket=new TicketMachine(cost);
  11.         System.out.println("1. Get Price");
  12.         System.out.println("2. Get Balance");
  13.         System.out.println("3. Insert Money");
  14.         System.out.println("4. Print Ticket");
  15.         int flag=1;
  16.         while(flag==1)
  17.         {
  18.             menu=scan.nextInt();
  19.             switch(menu)
  20.             {
  21.                 case 1:
  22.                 cost=ticket.getPrice();
  23.                 System.out.println(cost);
  24.                 break;
  25.                 case 2:
  26.                 balance=ticket.getBalance();
  27.                 System.out.println(balance);
  28.                 break;
  29.                 case 3:
  30.                 int money=scan.nextInt();
  31.                 ticket.insertMoney(money);
  32.                 break;
  33.                 case 4:
  34.                 ticket.printTicket();
  35.                 flag=0;
  36.                 break;
  37.             }
  38.         }
  39.     }
  40. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top