Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package moviebooking;
- import java.util.Scanner;
- public class MovieBooking {
- static Scanner sc = new Scanner(System.in);
- static String ID = "moszaza1307";
- static String password = "12345";
- static String ID1;
- static String password1;
- static int movie , time , total , discount1 , menu , total1 , total2;
- static double discount , money , change , money1 , discount2;
- static String seat[][] ={{"A1","A2","A3","A4","A3","A4","A5","A6"},
- {"B1","B2","B3","B4","B3","B4","B5","B6"},
- {"C1","C2","C3","C4","C3","C4","C5","C6"},
- {"D1","D2","D3","D4","D3","D4","D5","D6"},
- {"E1","E2","E3","E4","E3","E4","E5","E6"}};
- static String select;
- public static void login(){
- System.out.print("ID: ");
- ID1 = sc.next();
- System.out.print("Password: ");
- password1 = sc.next();
- while(!(ID.equals(ID1) && !password.equals(password1))){
- System.out.println("login failed, please try again.");
- System.out.print("Username: ");
- ID = sc.next();
- System.out.print("Password: ");
- password = sc.next();
- }
- }
- public static void chooseMovie(){
- System.out.println("***Movie***");
- System.out.println("DOCTOR STRANGE");
- System.out.println("FANTASTIC BEASTS");
- System.out.println("INFERNO");
- System.out.println("YOUR NAME ");
- System.out.print("Select>>> ");
- movie = sc.nextInt();
- switch(movie){
- case 1:
- System.out.println("***DOCTOR STRANGE***");
- System.out.println("1. 09.00\tCinema1");
- System.out.println("2. 12.00\tCinema3");
- System.out.print("Select>>> ");
- time =sc.nextInt();
- switch(time){
- case 1:
- System.out.println("***Cinema1***");
- seat();
- break;
- case 2:
- System.out.println("***Cinema3***");
- seat();
- break;
- }
- break;
- case 2:
- System.out.println("***FANTASTIC BEASTS***");
- System.out.println("1. 10.00\tCinema2");
- System.out.println("2. 14.00\tCinema5");
- System.out.print("Select>>> ");
- time =sc.nextInt();
- switch(time){
- case 1:
- System.out.println("***Cinema2***");
- seat();
- break;
- case 2:
- System.out.println("***Cinema5***");
- seat();
- break;
- }
- break;
- case 3:
- System.out.println("***INFERNO***");
- System.out.println("1. 09.30\tCinema5");
- System.out.println("2. 14.30\tCinema1");
- System.out.print("Select>>> ");
- time =sc.nextInt();
- switch(time){
- case 1:
- System.out.println("***Cinema5***");
- seat();
- break;
- case 2:
- System.out.println("***Cinema1***");
- seat();
- break;
- }
- break;
- case 4:
- System.out.println("***YOUR NAME***");
- System.out.println("1. 17.00\tCinema2");
- System.out.println("2. 19.00\tCinema5");
- System.out.print("Select>>> ");
- time =sc.nextInt();
- switch(time){
- case 1:
- System.out.println("***Cinema2***");
- seat();
- break;
- case 2:
- System.out.println("***Cinema5***");
- seat();
- break;
- }
- break;
- }
- }
- public static void seat(){
- int i=0;
- int j=0;
- do{ for(i=0; i<seat.length; i++){
- for(j=0; j<seat[i].length; j++){
- System.out.print(seat[i][j] + " ");
- }
- System.out.println(" ");
- }
- System.out.println("OO >>> Exit");
- System.out.print("Select>>> ");
- select = sc.next();
- for(i = 0; i<seat.length;i++){
- for(j=0; j<seat[i].length; j++){
- System.out.print(seat[i][j] + " ");
- }
- }
- total +=1;
- total1 = total-1;
- }while(!select.equals("OO") || !select.equals("oo"));
- }
- public static void discount(){
- System.out.println("1. Student Card(5%)");
- System.out.println("2. Gift voucher(10%)");
- System.out.println("3. Promotion form other(15%)");
- System.out.println("4. None");
- System.out.print("Select>>> ");
- discount1=sc.nextInt();
- switch(discount1){
- case 1:
- discount = (total1*120)*0.95;
- System.out.println("Total: "+discount+" B.");
- break;
- case 2:
- discount = (total1*120)*0.9;
- System.out.println("Total: "+discount+" B.");
- break;
- case 3:
- discount = (total1*120)*0.85;
- System.out.println("Total: "+discount+" B.");
- break;
- case 4:
- discount = total1*120;
- System.out.println("Total: "+discount+" B.");
- break;
- }
- }
- public static void cashier(){
- System.out.print("How much money?>>>");
- money = sc.nextDouble();
- change = money-discount;
- System.out.println("Change: "+ change);
- }
- public static void customerAndmoney(){
- total2+=total1;
- money1+=discount2;
- System.out.println("Customer: "+ total2);
- System.out.println("Money: "+ discount2 +"B.");
- }
- public static void main(String[] args) {
- login();
- do{System.out.println("***Booking Movie***");
- System.out.println(">>120 B./Seat<<");
- System.out.println("1. Movie");
- System.out.println("2. Cashier");
- System.out.println("3. Total customer");
- System.out.println("4. Exit");
- System.out.print("Select>>> ");
- menu = sc.nextInt();
- switch(menu){
- case 1:
- chooseMovie();
- break;
- case 2:
- System.out.println("***Pay for movie***");
- discount();
- cashier();
- discount2+=discount;
- break;
- case 3:
- customerAndmoney();
- break;
- }
- }while(menu!=4);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement