By GokiSoft.com| 20:30 23/03/2020|
Java Basic

TEST- Chương trình quản lý rạp chiếu film bằng java

Rạp chiếu phim quốc gia hiện nay đang cần thiết kế 1 chương trình nhằm kiểm soát toàn bộ hoạt động tại rạp bào gồm

- Quầy bán vé (ticket counter) => gồm các trạng thái (trống, khách hàng ít, khách hàng vừa phải và đang rất đông, thời điểm)

- Bãi đỗ xe (Parking) => gồm các trạng thái (trống, ít, vừa phải, full, thời điểm)

- Phòng xem phim => gồm các thuộc tính số ghế, số ghế đang ngồi, thời điểm

- Quầy bán đồ ăn => gồm các trạng thái (trống, khách hàng ít, khách hàng vừa phải và đang rất đông, thời điểm)

Viết chương trình quản lý thực hiện các yêu cầu sau

- Tạo 1 giao diện IStatus => có 1 phương thức onStatus => làm nhiệm vụ hiển thị trạng thái của từng địa điểm

- Thiết kế các lớp đối tượng trên => kế thừa từ IStatus

- Thiết kế các hàm nhập, hiển thị cho từng đối tượng trên

Trong class Main

- Nhập thông tin gồm 3 quầy bán vé, 2 quầy bán đồ ăn, 2 bãi đỗ xe và 5 phòng chiếu phim

- Tạo 1 phương thức followStatus(List<IStatus> statusList) thực hiện hiển thị trạng thái của tất cả các địa điểm => yêu cầu sử dụng hàm này cho >>> 3 quầy bán vé, 2 quầy bán đồ ăn, 2 bãi đỗ xe và 5 phòng chiếu phim >> trong chương trình trên

Phản hồi từ học viên

5

(Dựa trên đánh giá ngày hôm nay)

Nguyễn Hoàng Anh [C1907L]
Nguyễn Hoàng Anh

2020-03-24 15:53:13



/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package march23.movietheater;

import java.util.*;

/**
 *
 * @author Redmibook 14
 */
public class main {

    public static void main(String[] args) {
        ArrayList<IStatus> arrStatus = new ArrayList();
        TicketOffice ticketof = new TicketOffice();
        MovieRoom movieroom = new MovieRoom();
        ParkingLot parkinglot = new ParkingLot();
        FoodStall foodstall = new FoodStall();
        for (int i = 0; i < 3; i++) {
            System.out.println("Quay ve so " + (i + 1) + " :");
            ticketof.input();
            arrStatus.add(ticketof);
        }
        for (int i = 0; i < 5; i++) {
            System.out.println("Phong xem phim so " + (i + 1) + " :");
            movieroom.input();
            arrStatus.add(movieroom);
        }
        for (int i = 0; i < 2; i++) {
            System.out.println("Bai do xe so " + (i + 1) + " :");
            parkinglot.input();
            arrStatus.add(parkinglot);
        }
        for (int i = 0; i < 2; i++) {
             System.out.println("Quay do an so " + (i + 1) + " :");
            foodstall.input();
            arrStatus.add(foodstall);
        }

        for (int i = 0; i < arrStatus.size(); i++) {
            arrStatus.get(i).onStatus();
        }
    }
}



/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package march23.movietheater;

import java.util.*;

/**
 *
 * @author Redmibook 14
 */
public class MovieRoom implements IStatus {

    Scanner input = new Scanner(System.in);
    int seat;
    int onSeat;
    String date;

   

    @Override
    public void onStatus() {

        System.out.println("Date : " + date + ", Full seat : " + seat + ", On sitting : " + onSeat);

    }

    public void input() {
        System.out.println("Input date : ");
        this.date = input.nextLine();
        System.out.println("Input full seat : ");
        this.seat = Integer.parseInt(input.nextLine());
        System.out.println("Input seats has been sitted : ");
        this.onSeat = Integer.parseInt(input.nextLine());

    }
}



/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package march23.movietheater;

import java.util.Scanner;

/**
 *
 * @author Redmibook 14
 */
public class ParkingLot implements IStatus {

    Scanner input = new Scanner(System.in);
    String Status;
    String date;

    @Override
    public void onStatus() {

        System.out.println("Date : " + date + ",Parking Lot Status : " + Status);

    }

    public void input() {
        System.out.println("Input date : ");
        this.date = input.nextLine();
        System.out.println("1.Empty  ");
        System.out.println("2.Less");
        System.out.println("3.Normal  ");
        System.out.println("4.Full");
        int choice = Integer.parseInt(input.nextLine());
        switch (choice) {
            case 1:
                Status = "Empty";
                break;
            case 2:
                Status = "Less ";
                break;
            case 3:
                Status = "Normal";
                break;
            case 4:
                Status = "Full";
                break;
            default:

                break;
        }
    }

}



/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package march23.movietheater;

import java.util.*;

/**
 *
 * @author Redmibook 14
 */
public class TicketOffice implements IStatus {

    Scanner input = new Scanner(System.in);
    String Status;
    String date;

    @Override
    public void onStatus() {

        System.out.println("Date : " + date + ",Ticket Office Status : " + Status);

    }

    public void input() {
        System.out.println("Input date : ");
        this.date = input.nextLine();
        System.out.println("1.Empty  ");
        System.out.println("2.Less customer ");
        System.out.println("3.Normal  ");
        System.out.println("4.Verry Crowded ");
        int choice = Integer.parseInt(input.nextLine());
        switch (choice) {
            case 1:
                Status = "Empty";
                break;
            case 2:
                Status = "Less customer";
                break;
            case 3:
                Status = "Normal";
                break;
            case 4:
                Status = "Verry Crowded";
                break;
           default:
                
                break;
        }
    }

}



/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package march23.movietheater;

/**
 *
 * @author Redmibook 14
 */
interface IStatus {
     
    public void onStatus();

   
}



/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package march23.movietheater;

import java.util.*;

/**
 *
 * @author Redmibook 14
 */
public class main {

    public static void main(String[] args) {
        ArrayList<IStatus> arrStatus = new ArrayList();
        TicketOffice ticketof = new TicketOffice();
        MovieRoom movieroom = new MovieRoom();
        ParkingLot parkinglot = new ParkingLot();
        FoodStall foodstall = new FoodStall();
        for (int i = 0; i < 3; i++) {
            System.out.println("Quay ve so " + (i + 1) + " :");
            ticketof.input();
            arrStatus.add(ticketof);
        }
        for (int i = 0; i < 5; i++) {
            System.out.println("Phong xem phim so " + (i + 1) + " :");
            movieroom.input();
            arrStatus.add(movieroom);
        }
        for (int i = 0; i < 2; i++) {
            System.out.println("Bai do xe so " + (i + 1) + " :");
            parkinglot.input();
            arrStatus.add(parkinglot);
        }
        for (int i = 0; i < 2; i++) {
             System.out.println("Quay do an so " + (i + 1) + " :");
            foodstall.input();
            arrStatus.add(foodstall);
        }

        for (int i = 0; i < arrStatus.size(); i++) {
            arrStatus.get(i).onStatus();
        }
    }
}



Trương Công Vinh [T1907A]
Trương Công Vinh

2020-03-24 06:03:35


// ----->   Bổ sung ghi dữ liệu vào file và đọc dữ liệu từ file ...



/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Test;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author DELL
 */
public class Test {

    public static void main(String[] args) {
        ArrayList<IStatus> statusList;
        statusList = new ArrayList<>();
        inputStatus(statusList);
        followStatus(statusList);
        writeFile(statusList);
        System.out.print("\n\nREAD FILE !!! >>>");
        readFile(statusList);
        
    }

    public static void inputStatus(ArrayList<IStatus> statusList) {
        for (int i = 0; i < 3; i++) {
            int s = i + 1;
            System.out.println("phòng vé thứ " + s + " :\n");
            ticket_Counter t1 = new ticket_Counter();
            t1.input();
            statusList.add(t1);

        }
        for (int i = 0; i < 3; i++) {
            int s = i + 1;
            System.out.println("phòng vé thứ " + s + " :\n");
            do_an d1 = new do_an();
            d1.input();
            statusList.add(d1);

        }
        for (int i = 0; i < 3; i++) {
            int s = i + 1;
            System.out.println("phòng vé thứ " + s + " :\n");
            Parking p1 = new Parking();
            p1.input();
            statusList.add(p1);

        }

        for (int i = 0; i < 5; i++) {
            watching w = new watching();
            w.input();
            statusList.add(w);
        }

    }

    public static void followStatus(ArrayList<IStatus> statusList) {
        for (IStatus iStatus : statusList) {
            iStatus.onStatus();
        }
    }
    public static void writeFile(ArrayList<IStatus> statusList) {
        FileOutputStream fos = null;
        ObjectOutputStream oos = null;
        try {
            fos = new FileOutputStream("test.dat");
            oos = new ObjectOutputStream(fos);
            
            oos.writeObject(statusList);
            
        } catch (IOException ex) {
            System.err.println("Loi ghi file : \n"+ex);
        }finally{
            if (fos != null) {
                
                try {
                    fos.close();
                } catch (IOException ex) {
                    Logger.getLogger(Test.class.getName()).log(Level.SEVERE, null, ex);
                }
               
            }
            if (oos != null) {
                try {
                    oos.close();
                } catch (IOException ex) {
                    Logger.getLogger(Test.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
            System.out.println("Successfull !!");
        }
    }
    
        public static void readFile(ArrayList<IStatus> statusList) {
              FileInputStream fis = null;
              ObjectInputStream ois = null;
              try {
                  fis = new FileInputStream("test.dat");
                  ois = new ObjectInputStream(fis);
                  
                  try {
                      statusList = (ArrayList<IStatus>) ois.readObject();
                  } catch (ClassNotFoundException ex) {
                      Logger.getLogger(Test.class.getName()).log(Level.SEVERE, null, ex);
                  }
                  System.err.println(".........................");
                  for (IStatus iStatus : statusList) {
                      iStatus.onStatus();
                  }
                
            } catch (IOException ex) {
                  System.err.println("Loi doc file : "+ex);
            }finally{
                  if (fis != null) {
                      try {
                          fis.close();
                      } catch (IOException ex) {
                          Logger.getLogger(Test.class.getName()).log(Level.SEVERE, null, ex);
                      }
                  }
                  if (ois != null) {
                      try {
                          ois.close();
                      } catch (IOException ex) {
                          Logger.getLogger(Test.class.getName()).log(Level.SEVERE, null, ex);
                      }
                  }
              }
        }
}



/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Test;

import java.io.Serializable;

/**
 *
 * @author DELL
 */
public interface IStatus extends Serializable{
    public void onStatus();
}



Ngô Quang Huy [C1907L]
Ngô Quang Huy

2020-03-24 02:38:51



package March23;

import java.util.ArrayList;

public class Main {
    public static void main(String[] args) {
        ArrayList<Istatus> status = new ArrayList<>();
        for(int i=0;i<3;i++){
            TicketCounter Tkc = new TicketCounter();
            Tkc.input();
            status.add(Tkc);
        }
        for(int i=0;i<2;i++){
            Snack snk = new Snack();
            snk.input();
            status.add(snk);
        }
        for(int i=0;i<2;i++){
            Parking prk = new Parking();
            prk.input();
            status.add(prk);
        }
        for(int i=0;i<5;i++){
            Cinema cnm =new Cinema();
            cnm.input();
            status.add(cnm);
        }
        System.out.println("\nStatus: ");
        followStatus(status);
    }
    
    static void followStatus(ArrayList<Istatus> list){
        for (Istatus status : list) {
            status.onStatus();
        }
    }
}



package March23;

public interface Istatus {
    public void onStatus();
}



package March23;

import java.util.Scanner;

public class TicketCounter implements Istatus{
    String stat;
    String date;

    public TicketCounter() {
    }

    public TicketCounter(String stat, String date) {
        this.stat = stat;
        this.date = date;
    }

    public String getStat() {
        return stat;
    }

    public void setStat(String stat) {
        this.stat = stat;
    }

    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }
    
    @Override
    public void onStatus(){
        System.out.println("TicketCounter : " + stat + "At Date: "+ date);
    }
    public void input(){
        Scanner input = new Scanner(System.in);
        System.out.println("\nTicket Counter Status:");
        System.out.println("1. Nobody");
        System.out.println("2. A Few");
        System.out.println("3. OK");
        System.out.println("4. Crowded");
        int choose= Integer.parseInt(input.nextLine());
        switch(choose){
            case 1:
                stat="Nobody";
                break;
            case 2:
                stat="A Few";
                break;
            case 3:
                stat="OK";
                break;
            case 4:
                stat="Crowded";
                break;
        }
        System.out.print("Insert Date: ");
        date= input.nextLine();
    }
}



package March23;

import java.util.Scanner;

public class Parking implements Istatus{
    String stat;
    String date;

    public Parking() {
    }

    public Parking(String stat, String date) {
        this.stat = stat;
        this.date = date;
    }

    public String getStat() {
        return stat;
    }

    public void setStat(String stat) {
        this.stat = stat;
    }

    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }
    
    @Override
    public void onStatus(){
        System.out.println("Parking : " + stat + "At Date: "+ date);
    }
    public void input(){
        Scanner input = new Scanner(System.in);
        System.out.println("\nParking Status:");
        System.out.println("1. Empty");
        System.out.println("2. A Few");
        System.out.println("3. OK");
        System.out.println("4. Full");
        int choose= Integer.parseInt(input.nextLine());
        switch(choose){
            case 1:
                stat="Empty";
                break;
            case 2:
                stat="A Few";
                break;
            case 3:
                stat="OK";
                break;
            case 4:
                stat="Full";
                break;
        }
        System.out.print("Insert Date: ");
        date= input.nextLine();
    }
}



package March23;

import java.util.Scanner;

public class Cinema implements Istatus{
    int seat;
    int owned;
    String date;

    public Cinema() {
    }

    public Cinema(int seat, int owned, String date) {
        this.seat = seat;
        this.owned = owned;
        this.date = date;
    }

    public int getSeat() {
        return seat;
    }

    public void setSeat(int seat) {
        this.seat = seat;
    }

    public int getOwned() {
        return owned;
    }

    public void setOwned(int owned) {
        this.owned = owned;
    }

    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }
    
    @Override
    public void onStatus(){
        System.out.println("\nSeat: "+ seat);
        System.out.println("Owned Seat: "+ owned);
        System.out.println("Date: "+ date);
    }
    
    public void input(){
        Scanner input = new Scanner(System.in);
        System.out.print("\nNumber of Seat: ");
        seat= Integer.parseInt(input.nextLine());
        System.out.print("Number of Owned Seat: ");
        owned= Integer.parseInt(input.nextLine());
        System.out.print("Insert Date: ");
        date= input.nextLine();
    }
}



package March23;

import java.util.Scanner;

public class Snack implements Istatus{
    String stat;
    String date;

    public Snack() {
    }

    public Snack(String stat, String date) {
        this.stat = stat;
        this.date = date;
    }

    public String getStat() {
        return stat;
    }

    public void setStat(String stat) {
        this.stat = stat;
    }

    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }
    
    @Override
    public void onStatus(){
        System.out.println("Snack : " + stat + "At Date: "+ date);
    }
    public void input(){
        Scanner input = new Scanner(System.in);
        System.out.println("\nSnack Status:");
        System.out.println("1. Empty");
        System.out.println("2. A Few");
        System.out.println("3. OK");
        System.out.println("4. Crowded");
        int choose= Integer.parseInt(input.nextLine());
        switch(choose){
            case 1:
                stat="Empty";
                break;
            case 2:
                stat="A Few";
                break;
            case 3:
                stat="OK";
                break;
            case 4:
                stat="Crowded";
                break;
        }
        System.out.print("Insert Date: ");
        date= input.nextLine();
    }
}



Hoàng Quang Huy [C1907L]
Hoàng Quang Huy

2020-03-23 14:33:12




package testLesson5;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        ArrayList <IStatus> statusList = new ArrayList<>();
        for(int i=0; i<3 ;i++){
            TicketCounter ticketcounter = new TicketCounter();
            ticketcounter.input();
            statusList.add(ticketcounter);
        }
        for(int i=0; i<2 ;i++){
            FoodCounter foodcounter = new FoodCounter();
            foodcounter.input();
            statusList.add(foodcounter);
        }
        
        for(int i=0; i<2 ;i++){
            Parking parking = new Parking();
            parking.input();
            statusList.add(parking);
        }
        
        for(int i=0; i<5 ;i++){
            Movie movie = new Movie();
            movie.input();
            statusList.add(movie);
        }
        
        followStatus(statusList);
    }
    
    static void followStatus(List<IStatus> statusList){
        for (IStatus iStatus : statusList) {
            iStatus.onStatus();
        }
        
    } 
}
---------------------------------------------------------------------------------

package testLesson5;

public interface IStatus {
    public void onStatus();
}
----------------------------------------------------------------------------

package testLesson5;

import java.util.Scanner;

public class TicketCounter implements IStatus {

    String status;
    String time;

    public TicketCounter() {
    }

    public TicketCounter(String status, String time) {
        this.status = status;
        this.time = time;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    @Override
    public void onStatus() {
        System.out.println("TicketCounter Status: " + status);
    }

    public void input() {
        Scanner input = new Scanner(System.in);
        System.out.println("Input Ticket Counter Status: ");
        status = input.nextLine();
        System.out.println("Input Ticket Counter Time: ");
        time = input.nextLine();
    }

    public void output() {
        System.out.println("Status: " + status);
        System.out.println("Time: " + time);
    }
}
----------------------------------------------------------------------------

package testLesson5;

import java.util.Scanner;

public class Movie implements IStatus {

    int totalchair;
    int usedchair;
    String status;

    public Movie() {
    }

    public Movie(int totalchair, int usedchair, String status) {
        this.totalchair = totalchair;
        this.usedchair = usedchair;
        this.status = status;
    }

    public int getTotalchair() {
        return totalchair;
    }

    public void setTotalchair(int totalchair) {
        this.totalchair = totalchair;
    }

    public int getUsedchair() {
        return usedchair;
    }

    public void setUsedchair(int usedchair) {
        this.usedchair = usedchair;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String time) {
        this.status = status;
    }

    @Override
    public void onStatus() {
        System.out.println("Movie Status: " + status);
    }
    
    public void input() {
        Scanner input = new Scanner(System.in);
        System.out.println("Input Movie total chair: ");
        totalchair = Integer.parseInt(input.nextLine());
        System.out.println("Input Movie used chair: ");
        usedchair = Integer.parseInt(input.nextLine());
        System.out.println("Input Movie Status: ");
        status = input.nextLine();
    }
    
    public void output() {
        System.out.println("Total chair: " + totalchair);
        System.out.println("Used chair: " + usedchair);
        System.out.println("Status: " + status);
    }
}
-----------------------------------------------------------------------------------

package testLesson5;

import java.util.Scanner;

public class FoodCounter implements IStatus {

    String status;
    String time;

    public FoodCounter() {
    }

    public FoodCounter(String status, String time) {
        this.status = status;
        this.time = time;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    public void onStatus() {
        System.out.println("FoodCounter Status: " + status);
    }
    
    public void input(){
        Scanner input = new Scanner(System.in);
        System.out.println("Input FoodCounter Status: ");
        status = input.nextLine();
        System.out.println("Input FoodCounter Time: ");
        time = input.nextLine();
    }

    public void output() {
        System.out.println("Status: " + status);
        System.out.println("Time: " + time);
    }
}
------------------------------------------------------------------------------------

package testLesson5;

import java.util.Scanner;

public class Parking implements IStatus {

    String status;
    String time;

    public Parking() {
    }

    public Parking(String status, String time) {
        this.status = status;
        this.time = time;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    @Override
    public void onStatus() {
        System.out.println("Parking Status: " + status);
    }

    public void input(){
        Scanner input = new Scanner(System.in);
        System.out.println("Input Parking Status: ");
        status = input.nextLine();
        System.out.println("Input Parking Time: ");
        time = input.nextLine();
    }

    public void output() {
        System.out.println("Status: " + status);
        System.out.println("Time: " + time);
    }
}



trung [C1907L]
trung

2020-03-23 13:58:18



/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package test_interface;

/**
 *
 * @author prdox
 */
interface IStatus {
    public void onStatus();
    public void input();
    public void output();
}



/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package test_interface;

import java.util.Scanner;

/**
 *
 * @author prdox
 */
class TicketCounter implements IStatus{
    String status;

    public TicketCounter() {
    }

    public TicketCounter(String status) {
        this.status = status;
    }
    
    @Override
    public void input(){
        Scanner input = new Scanner(System.in);
        System.out.println("Ticket counter status: ");
        status = input.nextLine();
    }
    
    @Override
    public void output(){
        System.out.println(toString());
    }

    @Override
    public String toString() {
        return "TicketCounter{" + "status=" + status + '}';
    }
    
    @Override
    public void onStatus() {
        System.out.println("Status: "+this.status);
    }
    
}



/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package test_interface;

import java.util.Scanner;

/**
 *
 * @author prdox
 */
class Parking implements IStatus{
    String status;

    public Parking() {
    }

    public Parking(String status) {
        this.status = status;
    }
    
    @Override
    public void input(){
        Scanner input = new Scanner(System.in);
        System.out.println("Parking status: ");
        status = input.nextLine();
    }
    
    @Override
    public void output(){
        System.out.println(toString());
    }

    @Override
    public String toString() {
        return "Parking{" + "status=" + status + '}';
    }
    
    @Override
    public void onStatus() {
        System.out.println("Status: "+this.status);
    }
    
}



/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package test_interface;

import java.util.Scanner;

/**
 *
 * @author prdox
 */
class Cinema implements IStatus{
    int slot,activeSlot;
    String status;
    public Cinema() {
    }

    public Cinema(int slot, int activeSlot, String status) {
        this.slot = slot;
        this.activeSlot = activeSlot;
        this.status = status;
    }
    
    @Override
    public void input(){
        Scanner input = new Scanner(System.in);
        System.out.println("Cinema slot: ");
        slot = Integer.parseInt(input.nextLine());
        System.out.println("Cinema active slot: ");
        activeSlot = Integer.parseInt(input.nextLine());
        System.err.println("Cinema status");
        status = input.nextLine();
    }
    
    @Override
    public void output(){
        System.out.println(toString());
    }

    @Override
    public String toString() {
        return "Cinema{" + "slot=" + slot + ", activeSlot=" + activeSlot + ", status=" + status + '}';
    }

    @Override
    public void onStatus() {
        System.out.println("Status: "+this.status);
    }
    
}



/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package test_interface;

import java.util.Scanner;

/**
 *
 * @author prdox
 */
class FoodCenter implements IStatus{
    String status;

    public FoodCenter() {
    }

    public FoodCenter(String status) {
        this.status = status;
    }
    
    @Override
    public void input(){
        Scanner input = new Scanner(System.in);
        System.out.println("Food center status: ");
        status = input.nextLine();
    }
    
    @Override
    public void output(){
        System.out.println(toString());
    }

    @Override
    public String toString() {
        return "FoodCenter{" + "status=" + status + '}';
    }
    
    @Override
    public void onStatus() {
        System.out.println("Status: "+this.status);
    }
}



/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package test_interface;

import java.util.ArrayList;

/**
 *
 * @author prdox
 */
public class Main {
    public static void main(String[] args) {
        //3 quầy bán vé, 2 quầy bán đồ ăn, 2 bãi đỗ xe và 5 phòng chiếu phim
        ArrayList<IStatus> arr = new ArrayList<>();
        arr.add(new TicketCounter());
        arr.add(new TicketCounter());
        arr.add(new TicketCounter());
        arr.add(new FoodCenter());
        arr.add(new FoodCenter());
        arr.add(new Parking());
        arr.add(new Parking());
        arr.add(new Cinema());
        arr.add(new Cinema());
        arr.add(new Cinema());
        arr.add(new Cinema());
        arr.add(new Cinema());
        for (IStatus iStatus : arr) {
            iStatus.input();
        }
        followStatus(arr);
    }
    public static void followStatus(ArrayList<IStatus> statusList){
        for (IStatus iStatus : statusList) {
            iStatus.onStatus();
        }
    }
}



Nguyen Duc Viet [C1907L]
Nguyen Duc Viet

2020-03-23 13:43:41

/*

 * To change this license header, choose License Headers in Project Properties.

 * To change this template file, choose Tools | Templates

 * and open the template in the editor.

 */

package rapchieuphim;

import java.util.Scanner;

import java.util.ArrayList;

import java.util.List;

/**

 *

 * @author Viet

 */

public class Main {

    public static void main(String[] args)

    {

        List<IStatus> statusList = new ArrayList<>();

        inputStatus(statusList);

        followStatus(statusList);

     }

    public static void inputStatus(List<IStatus> statusList)

    {

        System.out.println("3 ticketcounter :");

        for ( int i = 0; i < 3 ; i++)

        {

            Ticketcounter ticketcounter = new Ticketcounter();

            ticketcounter.input();

            statusList.add(ticketcounter);

        }

        

        for (int i = 0 ; i < 2 ; i++)

        {

            Doan doan = new Doan();

            doan.input();

            statusList.add(doan);

        }

        for (int i = 0 ; i < 2 ; i++)

        {

            Parking parking = new Parking();

            parking.input();

            statusList.add(parking);

        }

        for (int i = 0 ; i < 5 ; i++)

        {

            Room room = new Room();

            room.input();

            statusList.add(room);

        }

    }

    public static void followStatus(List<IStatus> statusList)

    {

        for (IStatus statusList1 : statusList) {

              statusList1.onStatus();

        }

    }

    

}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package rapchieuphim;
import java.util.Scanner;
/**
 *
 * @author Viet
 */
public class Room implements IStatus {
    Integer chairnumber;
    Integer chairnumberon;
    String thoidiem;
    
    public Room()
    {
        
    }

    public Room(Integer chairnumber, Integer chairnumberon, String thoidiem) {
        this.chairnumber = chairnumber;
        this.chairnumberon = chairnumberon;
        this.thoidiem = thoidiem;
    }

    public Integer getChairnumber() {
        return chairnumber;
    }

    public void setChairnumber(Integer chairnumber) {
        this.chairnumber = chairnumber;
    }

    public Integer getChairnumberon() {
        return chairnumberon;
    }

    public void setChairnumberon(Integer chairnumberon) {
        this.chairnumberon = chairnumberon;
    }

    public String getThoidiem() {
        return thoidiem;
    }

    public void setThoidiem(String thoidiem) {
        this.thoidiem = thoidiem;
    }
    
    public void input()
    {
        Scanner scan = new Scanner(System.in);
        thoidiem = scan.nextLine();
        chairnumber = Integer.parseInt(scan.nextLine());
        chairnumberon = Integer.parseInt(scan.nextLine());
    }
    @Override
    public void onStatus()
    {
        Scanner scan = new Scanner(System.in);
        System.out.println("Thoi diem : " + thoidiem);
        System.out.println("So ghe :" + chairnumber);
        System.out.println("So ghe con :" + chairnumberon);
        
    }
    public void display()
    {
        System.out.println(toString());
    }

    @Override
    public String toString() {
        return "Room{" + "chairnumber=" + chairnumber + ", chairnumberon=" + chairnumberon + ", thoidiem=" + thoidiem + '}';
    }
    
    
}
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package rapchieuphim;
import java.util.Scanner;
/**
 *
 * @author Viet
 */
public class Ticketcounter implements IStatus {
    enum Status {
        Trong,
        Khachit,
        Khachvuaphai,
        Khachdong,
    }
    String thoidiem;
    Status status;
    public Ticketcounter()
    {
        
    }

    public Ticketcounter(String thoidiem) {
        this.thoidiem = thoidiem;
    }

    public String getThoidiem() {
        return thoidiem;
    }

    public void setThoidiem(String thoidiem) {
        this.thoidiem = thoidiem;
    }
    public void input()
    {
        Scanner scan = new Scanner(System.in);
        thoidiem = scan.nextLine();
        
        int choice = Integer.parseInt(scan.nextLine());
        switch(choice)
        {
            case 1 :
                status = Status.Trong;
                break;
            case 2 :
                status = Status.Khachit;
                break;
            case 3 :
                status = Status.Khachvuaphai;
                break;
            case 4 :
                status = Status.Khachdong;
                break;
            default :
                System.out.println("Moi nhap lai");
                break;
        }
        
    }
    @Override
    public void onStatus()
    {
        Scanner scan = new Scanner(System.in);
        System.out.println("thoi diem :" + thoidiem);
        switch(status)
        {
            case Trong :
                System.out.println("Trong");
                break;
            case Khachit :
                System.out.println("Khachit");
                break;
            case Khachvuaphai :
                System.out.println("Khachvuaphai");
                break;
            case Khachdong :
                System.out.println("Khachdong");
                break;
        }
    }
    
    public void display()
    {
        System.out.println(thoidiem + status);
    }
}
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package rapchieuphim;
import java.util.Scanner;
/**
 *
 * @author Viet
 */
public class Parking implements IStatus {
    enum Status{
        Trong,
        It,
        Vuaphai,
        Full,
    }
    String thoidiem;
    Status status;
    public Parking()
    {
        
        
    }

    public Parking(String thoidiem) {
        this.thoidiem = thoidiem;
    }

    public String getThoidiem() {
        return thoidiem;
    }

    public void setThoidiem(String thoidiem) {
        this.thoidiem = thoidiem;
    }
    @Override
    public void onStatus(){
        Scanner scan = new Scanner(System.in);
        
        System.out.println("Thoi diem :" + thoidiem);
        switch(status)
        {
            case Trong :
                System.out.println("Trong");
                break;
            case It :
                System.out.println("It");
                break;
            case Vuaphai :
                System.out.println("Vuaphai");
                break;
            case Full :
                System.out.println("Full");
                break;
        }
        
        
    }
    public void input()
    {
        Scanner scan = new Scanner(System.in);
        thoidiem = scan.nextLine();
        System.out.println("Pick");
        System.out.println("1.Trong");
        System.out.println("2. It");
        System.out.println("3.Vuaphai");
        System.out.println("4.Full");
        int choice = Integer.parseInt(scan.nextLine());
        switch(choice)
        {
            case 1 :
                status = Status.Trong;
                break;
            case 2 : 
                status = Status.It;
                break;
            case 3 :
                status = Status.Vuaphai;
                break;
            case 4 :
                status = Status.Full;
                break;
            default :
                System.out.println("Moi ban nhap vao");
                break;
        }
        
        
        
        
    }
    public void display()
    {
        System.out.println(thoidiem + status);
    }
    
}
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package rapchieuphim;

/**
 *
 * @author Viet
 */
public interface IStatus {
    public void onStatus();
}
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package rapchieuphim;
import java.util.Scanner;
/**
 *
 * @author Minh
 */
public class Doan implements IStatus {
    static enum Doan_Status{
        Trong,
        Khachhangit,
        Khachvuaphai,
        Khachratdong;
    }
    String thoidiem;
    Doan_Status status;
    
    public Doan()
    {
        
    }

    public Doan(String thoidiem) {
        this.thoidiem = thoidiem;
    }

    public String getThoidiem() {
        return thoidiem;
    }

    public void setThoidiem(String thoidiem) {
        this.thoidiem = thoidiem;
    }
    
    @Override
    public void onStatus()
    {
        System.out.println("Thoi diem : " + thoidiem);
        
        switch(status)
        {
            case Trong :
                System.out.println("Trong");
                break;
            case Khachhangit :
                System.out.println("Khach hang it");
                break;
            case Khachvuaphai :
                System.out.println("Khach vua phai");
                break;
            case Khachratdong :
                System.out.println("Khach rat dong");
                break;
        }
        
    }
    public void input()
    {
        int choose;
        Scanner scan = new Scanner(System.in);
        thoidiem = scan.nextLine();
        
        System.out.println("Moi ban nhap tinh trang");
        System.out.println("1. Trong");
        System.out.println("2. Khachhangit");
        System.out.println("3. Khachvuaphai");
        System.out.println("4. Khachratdong");
        choose = Integer.parseInt(scan.nextLine());
        
        switch(choose)
        {
            case 1 :
                status = Doan_Status.Trong;
                break;
            case 2 :
                status = Doan_Status.Khachhangit;
                break;
            case 3 :
                status = Doan_Status.Khachvuaphai;
                break;
            case 4 :
                status = Doan_Status.Khachratdong;
                break;
            default :System.out.println("Moi ban nhap lai");
                break;
        }
        
    }    
    public void display()
    {
        System.out.println(thoidiem + status);
    }
}


NguyenHuuThanh [T1907A]
NguyenHuuThanh

2020-03-17 10:20:44



/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package rapchieuphim;
import java.util.Scanner;
import java.util.ArrayList;
import java.util.List;
/**
 *
 * @author Minh
 */
public class Main {
    public static void main(String[] args)
    {
        List<IStatus> statusList = new ArrayList<>();
        inputStatus(statusList);
        followStatus(statusList);
     }
    public static void inputStatus(List<IStatus> statusList)
    {
        System.out.println("3 ticketcounter :");
        for ( int i = 0; i < 3 ; i++)
        {
            Ticketcounter ticketcounter = new Ticketcounter();
            ticketcounter.input();
            statusList.add(ticketcounter);
        }
        
        for (int i = 0 ; i < 2 ; i++)
        {
            Doan doan = new Doan();
            doan.input();
            statusList.add(doan);
        }
        for (int i = 0 ; i < 2 ; i++)
        {
            Parking parking = new Parking();
            parking.input();
            statusList.add(parking);
        }
        for (int i = 0 ; i < 5 ; i++)
        {
            Room room = new Room();
            room.input();
            statusList.add(room);
        }
    }
    public static void followStatus(List<IStatus> statusList)
    {
        for (IStatus statusList1 : statusList) {
              statusList1.onStatus();
        }
    }
    
}



/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package rapchieuphim;
import java.util.Scanner;
/**
 *
 * @author Minh
 */
public class Room implements IStatus {
    Integer chairnumber;
    Integer chairnumberon;
    String thoidiem;
    
    public Room()
    {
        
    }

    public Room(Integer chairnumber, Integer chairnumberon, String thoidiem) {
        this.chairnumber = chairnumber;
        this.chairnumberon = chairnumberon;
        this.thoidiem = thoidiem;
    }

    public Integer getChairnumber() {
        return chairnumber;
    }

    public void setChairnumber(Integer chairnumber) {
        this.chairnumber = chairnumber;
    }

    public Integer getChairnumberon() {
        return chairnumberon;
    }

    public void setChairnumberon(Integer chairnumberon) {
        this.chairnumberon = chairnumberon;
    }

    public String getThoidiem() {
        return thoidiem;
    }

    public void setThoidiem(String thoidiem) {
        this.thoidiem = thoidiem;
    }
    
    public void input()
    {
        Scanner scan = new Scanner(System.in);
        thoidiem = scan.nextLine();
        chairnumber = Integer.parseInt(scan.nextLine());
        chairnumberon = Integer.parseInt(scan.nextLine());
    }
    @Override
    public void onStatus()
    {
        Scanner scan = new Scanner(System.in);
        System.out.println("Thoi diem : " + thoidiem);
        System.out.println("So ghe :" + chairnumber);
        System.out.println("So ghe con :" + chairnumberon);
        
    }
    public void display()
    {
        System.out.println(toString());
    }

    @Override
    public String toString() {
        return "Room{" + "chairnumber=" + chairnumber + ", chairnumberon=" + chairnumberon + ", thoidiem=" + thoidiem + '}';
    }
    
    
}



/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package rapchieuphim;
import java.util.Scanner;
/**
 *
 * @author Minh
 */
public class Ticketcounter implements IStatus {
    enum Status {
        Trong,
        Khachit,
        Khachvuaphai,
        Khachdong,
    }
    String thoidiem;
    Status status;
    public Ticketcounter()
    {
        
    }

    public Ticketcounter(String thoidiem) {
        this.thoidiem = thoidiem;
    }

    public String getThoidiem() {
        return thoidiem;
    }

    public void setThoidiem(String thoidiem) {
        this.thoidiem = thoidiem;
    }
    public void input()
    {
        Scanner scan = new Scanner(System.in);
        thoidiem = scan.nextLine();
        
        int choice = Integer.parseInt(scan.nextLine());
        switch(choice)
        {
            case 1 :
                status = Status.Trong;
                break;
            case 2 :
                status = Status.Khachit;
                break;
            case 3 :
                status = Status.Khachvuaphai;
                break;
            case 4 :
                status = Status.Khachdong;
                break;
            default :
                System.out.println("Moi nhap lai");
                break;
        }
        
    }
    @Override
    public void onStatus()
    {
        Scanner scan = new Scanner(System.in);
        System.out.println("thoi diem :" + thoidiem);
        switch(status)
        {
            case Trong :
                System.out.println("Trong");
                break;
            case Khachit :
                System.out.println("Khachit");
                break;
            case Khachvuaphai :
                System.out.println("Khachvuaphai");
                break;
            case Khachdong :
                System.out.println("Khachdong");
                break;
        }
    }
    
    public void display()
    {
        System.out.println(thoidiem + status);
    }
}



/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package rapchieuphim;
import java.util.Scanner;
/**
 *
 * @author Minh
 */
public class Parking implements IStatus {
    enum Status{
        Trong,
        It,
        Vuaphai,
        Full,
    }
    String thoidiem;
    Status status;
    public Parking()
    {
        
        
    }

    public Parking(String thoidiem) {
        this.thoidiem = thoidiem;
    }

    public String getThoidiem() {
        return thoidiem;
    }

    public void setThoidiem(String thoidiem) {
        this.thoidiem = thoidiem;
    }
    @Override
    public void onStatus(){
        Scanner scan = new Scanner(System.in);
        
        System.out.println("Thoi diem :" + thoidiem);
        switch(status)
        {
            case Trong :
                System.out.println("Trong");
                break;
            case It :
                System.out.println("It");
                break;
            case Vuaphai :
                System.out.println("Vuaphai");
                break;
            case Full :
                System.out.println("Full");
                break;
        }
        
        
    }
    public void input()
    {
        Scanner scan = new Scanner(System.in);
        thoidiem = scan.nextLine();
        System.out.println("Pick");
        System.out.println("1.Trong");
        System.out.println("2. It");
        System.out.println("3.Vuaphai");
        System.out.println("4.Full");
        int choice = Integer.parseInt(scan.nextLine());
        switch(choice)
        {
            case 1 :
                status = Status.Trong;
                break;
            case 2 : 
                status = Status.It;
                break;
            case 3 :
                status = Status.Vuaphai;
                break;
            case 4 :
                status = Status.Full;
                break;
            default :
                System.out.println("Moi ban nhap vao");
                break;
        }
        
        
        
        
    }
    public void display()
    {
        System.out.println(thoidiem + status);
    }
    
}



/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package rapchieuphim;

/**
 *
 * @author Minh
 */
public interface IStatus {
    public void onStatus();
}



/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package rapchieuphim;
import java.util.Scanner;
/**
 *
 * @author Minh
 */
public class Doan implements IStatus {
    static enum Doan_Status{
        Trong,
        Khachhangit,
        Khachvuaphai,
        Khachratdong;
    }
    String thoidiem;
    Doan_Status status;
    
    public Doan()
    {
        
    }

    public Doan(String thoidiem) {
        this.thoidiem = thoidiem;
    }

    public String getThoidiem() {
        return thoidiem;
    }

    public void setThoidiem(String thoidiem) {
        this.thoidiem = thoidiem;
    }
    
    @Override
    public void onStatus()
    {
        System.out.println("Thoi diem : " + thoidiem);
        
        switch(status)
        {
            case Trong :
                System.out.println("Trong");
                break;
            case Khachhangit :
                System.out.println("Khach hang it");
                break;
            case Khachvuaphai :
                System.out.println("Khach vua phai");
                break;
            case Khachratdong :
                System.out.println("Khach rat dong");
                break;
        }
        
    }
    public void input()
    {
        int choose;
        Scanner scan = new Scanner(System.in);
        thoidiem = scan.nextLine();
        
        System.out.println("Moi ban nhap tinh trang");
        System.out.println("1. Trong");
        System.out.println("2. Khachhangit");
        System.out.println("3. Khachvuaphai");
        System.out.println("4. Khachratdong");
        choose = Integer.parseInt(scan.nextLine());
        
        switch(choose)
        {
            case 1 :
                status = Doan_Status.Trong;
                break;
            case 2 :
                status = Doan_Status.Khachhangit;
                break;
            case 3 :
                status = Doan_Status.Khachvuaphai;
                break;
            case 4 :
                status = Doan_Status.Khachratdong;
                break;
            default :System.out.println("Moi ban nhap lai");
                break;
        }
        
    }    
    public void display()
    {
        System.out.println(thoidiem + status);
    }
}



thienphu [T1907A]
thienphu

2020-03-17 08:56:14



/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package RapChieuPhim;

/**
 *
 * @author Thien Phu
 */
public interface IStatus {
    void onStatus();
}



/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package RapChieuPhim;

import java.util.Scanner;

/**
 *
 * @author Thien Phu
 */
public class TicketCounter implements IStatus {

    private static Scanner sc = new Scanner(System.in);

    @Override
    public void onStatus() {
        System.out.println("Thong tin TiketCounter: Thoi diem: " + this.time + "\t Trang thai:" + this.sts);

    }

    static enum status {

        emty, lessCustomers, moderateCustomers, crowded,
    }
    private String time;
    status sts;

    public TicketCounter() {
    }

    public TicketCounter(String time, status sts) {
        this.time = time;
        this.sts = sts.emty;
    }

    public void input() {

        System.out.println("Nhap thong tin TicketCounter:");
        System.out.println("Nhap time");
        time = sc.nextLine();
        inputStatus();
    }

    public void inputStatus() {
        System.out.println("Status: ");
        System.out.println("1:Trong");
        System.out.println("2:Khach hang it");
        System.out.println("3:Khach hang vua phai");
        System.out.println("4:Dong Khach");
        int choose;
        do {
            choose = Integer.parseInt(sc.nextLine());
            switch (choose) {
                case 1:
                    sts = status.emty;
                    break;
                case 2:
                    sts = status.lessCustomers;
                    break;
                case 3:
                    sts = status.moderateCustomers;
                    break;
                case 4:
                    sts = status.crowded;
                    break;
                default:
                    System.err.println("Chon lai di");
                    break;
            }
        } while (choose < 1 || choose > 4);
    }

    public void setTime(String time) {
        this.time = time;
    }

    public String getTime() {
        return time;
    }

}



/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package RapChieuPhim;

import java.util.Scanner;

/**
 *
 * @author Thien Phu
 */
public class Movieroom implements IStatus { // rạp chiếu phim

    private int seats, numberSeats; //seats: số ghế// numberSeats: số ghế đang ngồi
    private String time;

    public Movieroom() {
    }

    public Movieroom(int seats, int numberSeats, String time) {
        this.seats = seats;
        this.numberSeats = numberSeats;
        this.time = time;
    }

    public int getSeats() {
        return seats;
    }

    public void setSeats(int seats) {
        this.seats = seats;
    }

    public int getNumberSeats() {
        return numberSeats;
    }

    public void setNumberSeats(int numberSeats) {
        this.numberSeats = numberSeats;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    @Override
    public void onStatus() {
        System.out.println("Thong tin rạp phim: Tổng số ghế: " + seats + "\t Số ghế đang ngồi: " + numberSeats + "\t Thời gian: " + time);
    }

    public void input() {
        Scanner sc = new Scanner(System.in);
        System.out.println("Nhap thong tin rap chieu phim");
        System.out.println("Thoi điểm check:");
        time = sc.nextLine();
        System.out.println("Tong so ghe: ");
        seats = sc.nextInt();
        System.out.println("So ghe đang ngồi:");
        numberSeats = sc.nextInt();
    }

}



/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package RapChieuPhim;

import java.util.Scanner;

/**
 *
 * @author Thien Phu
 */
public class Parking implements IStatus {

    private static Scanner sc = new Scanner(System.in);

    @Override
    public void onStatus() {
        System.out.println("Information Parking: Time: " + this.time + "\t Status: " + this.sts);
    }

    static enum status {

        empty, little, medium, full
    }
    private status sts;
    private String time;

    public Parking() {
    }

    public Parking(status sts, String time) {
        this.sts = sts.empty;
        this.time = time;
    }

    public void input() {

        System.out.println("Nhap thong tin Parking:");
        System.out.println("Nhap time");
        time = sc.nextLine();
        inputStatus();
    }

    public void inputStatus() {
        System.out.println("Status: ");
        System.out.println("1:Trong");
        System.out.println("2:Ít xe");
        System.out.println("3:Xe vua phai");
        System.out.println("4:hết chỗ để xe");
        int choose;
        do {
            choose = Integer.parseInt(sc.nextLine());
            switch (choose) {
                case 1:
                    sts = status.empty;
                    break;
                case 2:
                    sts = status.little;
                    break;
                case 3:
                    sts = status.medium;
                    break;
                case 4:
                    sts = status.full;
                    break;
                default:
                    System.err.println("Chon lai di");
                    break;
            }
        } while (choose < 1 || choose > 4);
    }

    public status getSts() {
        return sts;
    }

    public void setSts(status sts) {
        this.sts = sts;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

}



/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package RapChieuPhim;

import java.util.Scanner;

/**
 *
 * @author Thien Phu
 */
public class Foodstall implements IStatus {

    private String time;
    private static Scanner sc = new Scanner(System.in);

    @Override
    public void onStatus() {
        System.out.println("Information Foodstall: Time: " + time + "\t Status: " + this.sts);
    }

    static enum status {

        emty, lessCustomers, moderateCustomers, crowded,
    }
    private status sts;

    public Foodstall() {
    }

    public Foodstall(String time, status sts) {
        this.time = time;
        this.sts = sts.emty;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    public status getSts() {
        return sts;
    }

    public void setSts(status sts) {
        this.sts = sts;
    }

    public void input() {

        System.out.println("Nhap thong tin Foodstall:");
        System.out.println("Nhap time");
        time = sc.nextLine();
        inputStatus();
    }

    public void inputStatus() {
        System.out.println("Status: ");
        System.out.println("1:Trong");
        System.out.println("2:Khach hang it");
        System.out.println("3:Khach hang vua phai");
        System.out.println("4:Dong Khach");
        int choose;
        do {
            choose = Integer.parseInt(sc.nextLine());
            switch (choose) {
                case 1:
                    sts = status.emty;
                    break;
                case 2:
                    sts = status.lessCustomers;
                    break;
                case 3:
                    sts = status.moderateCustomers;
                    break;
                case 4:
                    sts = status.crowded;
                    break;
                default:
                    System.err.println("Chon lai di");
                    break;
            }
        } while (choose < 1 || choose > 4);
    }
}



/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package RapChieuPhim;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Thien Phu
 */
public class Main {

    public static void main(String[] args) {
        List<IStatus> danhsach = new ArrayList<>();
        //nhap thong tin 3 quay ve
        for (int i = 0; i < 3; i++) {
            System.out.println("Quầy TicketCounter " + (i + 1));
            TicketCounter tk = new TicketCounter();
            tk.input();
            danhsach.add(tk);
        }
        for (int i = 0; i < 2; i++) {
            System.out.println("Quầy Foodstall " + (i + 1));
            Foodstall fs = new Foodstall();
            fs.input();
            danhsach.add(fs);
        }
        for (int i = 0; i < 2; i++) {
            System.out.println("Quầy Parking " + (i + 1));
            Parking pk = new Parking();
            pk.input();
            danhsach.add(pk);
        }
        for (int i = 0; i < 5; i++) {
            System.out.println("Quầy Movieroom " + (i + 1));
            Movieroom mv = new Movieroom();
            mv.input();
            danhsach.add(mv);
        }
        for (IStatus danhsach1 : danhsach) {
            danhsach1.onStatus();
        }

    }

}



nguyễn văn huy [T1907A]
nguyễn văn huy

2020-03-17 07:19:13



/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package fiml;
import java.util.*;
/**
 *
 * @author ASUS
 */
public interface IStatus {
    public void onStatus();
}
////////
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package fiml;

import java.util.*;

/**
 *
 * @author ASUS
 */
public class Main {

    public static void main(String[] args) {
        ArrayList<IStatus> mainList = new ArrayList<>();
        Scanner scan = new Scanner(System.in);
        nhapStatus(mainList);
        followStatus(mainList);
    }

    public static void nhapStatus(ArrayList<IStatus> mainList) {

        //3 quầy bán vé
        for (int i = 0; i <= 3; i++) {
            System.out.println("Nhập thông tin phòng vé thứ " + (i + 1) + " :");
            banve bv = new banve() {
            };
            bv.nhap();
            mainList.add(bv);

        }
        // 2 bãi đỗ xe
        for (int i = 0; i <= 2; i++) {
            System.out.println("Nhập thông tin bai xe thứ " + (i + 1) + " :");
            baixe bx = null;
            bx.nhap();
            mainList.add(bx);
        }
        //2 quầy bán đồ ăn
        for (int j = 0; j <= 2; j++) {
            System.out.println("Nhập thông tin quay do an thứ " + (j + 1) + " :");
            doawn da = new doawn();
            da.nhap();
            mainList.add(da);
        }
        // 5 phòng chiếu phim
        for (int m = 0; m < 5; m++) {
            System.out.println("Nhập thông tin cho phòng chiếu phim " + (m + 1) + " :");
            phongfiml pp = new phongfiml();
            pp.nhap();
            mainList.add(pp);

        }
    }
    public static void followStatus(ArrayList<IStatus> statusList) {
        for (IStatus iStatus : statusList) {
            iStatus.onStatus();
        }
    }
}
/**
 *
 * @param mainList
 */

//////
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package fiml;

import java.util.*;

/**
 *
 * @author ASUS
 */
public abstract class baixe implements IStatus {

    public enum Tong {
        trong, it, vua, full
    }
    String thoigian;
    Tong tong;
    public void nhap(){
        Scanner scan=new Scanner(System.in);
        System.out.println("nhap thoi gian");
        thoigian=scan.nextLine();
        System.out.println("1.Trong");
        System.out.println("2.It");
        System.out.println("3.Vua");
        System.out.println("4.Dong");
        int n=Integer.parseInt(scan.nextLine());
        switch(n){
            case 1:
                System.out.println("bai ko xe");
                break;
            case 2:
                System.out.println("bai it xe");
                break;
            case 3:
                System.out.println("bai xe kha nhieu");
                break;
            case 4:
                System.out.println("bai chat rui>>>>>");
                break;
            default:
               break;
        }
    }
    public void onStatus(){
        System.out.println("cho xe????");
        switch(tong){
            case trong:
                System.out.println("co se dau''''");
                break;
            case it:
                System.out.println("co it lam");
                break;
            case vua:
                System.out.println("cung du de trong...");
                break;
            case full:
                System.out.println("full?????");
                break;
            default:
                break;
        }
    }
}
//////
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package fiml;

import java.util.*;

/**
 *
 * @author ASUS
 */
public abstract class banve implements IStatus {

    public enum Tong {
        trong, itkhach, vua, dong;
    }
    Tong tong;
    String thoigian;

    public void nhap() {
        Scanner scan = new Scanner(System.in);
        System.out.println("nhap thoi gian");
        thoigian = scan.nextLine();
        System.out.println("1.trong");
        System.out.println("2.it khach");
        System.out.println("3.vua phai");
        System.out.println("4.dong");
        System.out.println("tao");
        int n = Integer.parseInt(scan.nextLine());
        switch (n) {
            case 1:
                tong = Tong.trong;
                break;
            case 2:
                tong = Tong.itkhach;
                break;
            case 3:
                tong = Tong.vua;
                break;
            case 4:
                tong = Tong.dong;
                break;
            default:
                System.out.println(".......Sai");
                break;
        }
    }

    @Override
    public void onStatus() {
        System.out.println("ban ve .....");
        System.out.println("thoi diem://" + thoigian);
        switch (tong) {
            case trong:
                System.out.println("ko ban dc....");
                break;
            case itkhach:
                System.out.println("qua it khach/////");
                break;
            case vua:
                System.out.println("dat chi tieu ban");
                break;
            case dong:
                System.out.println("dong qua");
                break;
            default:
                break;

        }
    }

}
//////
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package fiml;
import java.util.*;
/**
 *
 * @author ASUS
 */
public class doawn implements IStatus{
   
         public enum Tong {
        trong, it, vua, full
    }
    String thoigian;
    Tong tong;
    public void nhap(){
        Scanner scan=new Scanner(System.in);
        System.out.println("nhap thoi gian");
        thoigian=scan.nextLine();
        System.out.println("1.Trong");
        System.out.println("2.It");
        System.out.println("3.Vua");
        System.out.println("4.Dong");
        int n=Integer.parseInt(scan.nextLine());
        switch(n){
            case 1:
                System.out.println("ko ban dc");
                break;
            case 2:
                System.out.println("ban it ");
                break;
            case 3:
                System.out.println("ban kha nhieu");
                break;
            case 4:
                System.out.println("ban het rui>>>>>");
                break;
            default:
               break;
        }
    }
    public void onStatus(){
        System.out.println("quan ban do an????");
        switch(tong){
            case trong:
                System.out.println("co ban dc dau''''");
                break;
            case it:
                System.out.println("ban it lam");
                break;
            case vua:
                System.out.println("cung du chi tieu...");
                break;
            case full:
                System.out.println("full?????");
                break;
            default:
                break;
        }
    
    }
}
/////
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package fiml;
import java.util.*;
/**
 *
 * @author ASUS
 */
public  class phongfiml implements IStatus {
    int n,m;//nla ghe dang ngoi,m la tong ghe
    String thoigian;
    int effect=m-n;
    public void nhap(){
        Scanner scan=new Scanner(System.in);
        System.out.println("tong so ghe:");
        m=Integer.parseInt(scan.nextLine());
        System.out.println("thoi hian");
        thoigian=scan.nextLine();
        for (; ; ) {
            System.out.println("nhap so ghe dang ngoi");
            n=Integer.parseInt(scan.nextLine());
            if(m<n){
                System.out.println("het het rui:)))");
            }else{
                System.out.println("con day ghe");
            }
        }
    }
  
    public void onStatus(){
        System.out.println("thong tin rap");
        System.out.println("so ghe da dung"+n);
        System.out.println("tong ghe"+m);
        System.out.println("so ghe con neu co"+effect);
        System.out.println("thoi gian"+thoigian);
    }
}



Minh Nghia [T1907A]
Minh Nghia

2020-03-16 16:28:24



/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Film;

import java.util.Scanner;

/**
 *
 * @author Administrator
 */
public class TicketCounter implements IStatus{
    static enum TICKITCOUNTER_STATUS{
        VACANT, FEWCUS, MODERATECUS, VERYCROWDED
    }
    TICKITCOUNTER_STATUS tickitcounter;
    String moment;
    
    public void input(){
        Scanner scan = new Scanner(System.in);
        
        System.out.println("Enter the moment: ");
        moment = scan.nextLine();
        
        System.out.println("Enter status:");
        System.out.println("1. Enter vacant:");
        System.out.println("2. Enter few customers:");
        System.out.println("3. Enter moderate customers:");
        System.out.println("4. Enter very crowded:");
        System.out.println("Choose:");
        int choose = Integer.parseInt(scan.nextLine());
        switch(choose){
            case 1:
                tickitcounter = TICKITCOUNTER_STATUS.VACANT;
                break;
            case 2:
                tickitcounter = TICKITCOUNTER_STATUS.FEWCUS;
                break;
            case 3:
                tickitcounter = TICKITCOUNTER_STATUS.MODERATECUS;
                break;
            case 4:
                tickitcounter = TICKITCOUNTER_STATUS.VERYCROWDED;
                break;
            default:
                break;
        }
    }
    public void onStatus(){
        System.out.println("TicketConter");
        System.out.println("Moment:" + moment);
        switch(tickitcounter){
            case VACANT:
                System.out.println("Vacant :");
                break;
            case FEWCUS:
                System.out.println("Few customers");
                break;
            case MODERATECUS:
                System.out.println("Moderate customers"); 
                break;
            case VERYCROWDED:
                System.out.println("Very crowded");
                break;
    }
}
}



/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Film;

import java.util.Scanner;

/**
 *
 * @author Administrator
 */
public class Parking implements IStatus{
    static enum PARKING_STATUS{
        VACANT,LITTLE,MODERATE,FULL
    }
    PARKING_STATUS parking;
    String moment;
    
    public void input(){
        Scanner scan = new Scanner(System.in);
        
        System.out.println("Enter moment:");
        moment = scan.nextLine();
        
        System.out.println("Status:");
        System.out.println("1. Vacant");
        System.out.println("2. Little");
        System.out.println("3. Moderate");
        System.out.println("4. Full");
        System.out.println("Choose");
        
        int choose = Integer.parseInt(scan.nextLine());
        switch(choose){
            case 1:
                parking = PARKING_STATUS.VACANT;
                break;
            case 2:
                parking = PARKING_STATUS.LITTLE;
                break;
            case 3:
                parking = PARKING_STATUS.MODERATE;
                break;
            case 4:
                parking = PARKING_STATUS.FULL;
                break;
            default:
                break;
        }
    }
    public void onStatus(){
        System.out.println("Parking");
        System.out.println("Moment:" + moment);
        switch(parking){
            case VACANT:
                System.out.println("Vacant");
                break;
            case LITTLE:
                System.out.println("Little");
                break;
            case MODERATE:
                System.out.println("Moderate");
                break;
            case FULL:
                System.out.println("Full");
                break;
            default:
                break;
                
        }
    }
}



/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Film;

import java.util.Scanner;

/**
 *
 * @author Administrator
 */
public class MovieRoom implements IStatus{
    int totalSeats;
    int numberOfSeats;
    String moment;


    
    public void input(){
        Scanner input = new Scanner(System.in);
        
        System.out.println("Enter seat:");
        totalSeats = Integer.parseInt(input.nextLine());
        
        for(;;){
            
        System.out.println("Enter numberOfSeats : ");
        numberOfSeats = Integer.parseInt(input.nextLine());
            if (numberOfSeats > totalSeats) {
                System.out.println("The number of seats in use must be smaller than the total number of seat");
            }else{
                break;
            }
        System.out.println("Moment : ");
        moment = input.nextLine();
        }
    }
    
    public void onStatus(){
        System.out.println("MovieRoom");
        System.out.println("totalSeats:" + totalSeats);
        System.out.println("NumberOfSeats:" + numberOfSeats);
        System.out.println("Moment:" + moment);
    }
}



/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Film;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Administrator
 */
public class Main {
    public static void main(String[] args) {
        List<IStatus> statusList ;
        statusList = new ArrayList<>();
        inputStatus(statusList);
        followStatus(statusList);
        
    }
    static void inputStatus(List<IStatus>statusList){
        for (int i = 0; i < 3; i++) {
            int s = i +1;
            System.out.println("Enter 3 ticket counters:" + s);
            TicketCounter TC = new TicketCounter();
            TC.input();
            statusList.add(TC);
        }
        for (int i = 0; i < 2 ; i++) {
            int s = i+1;
            System.out.println("Enter 2 food stalls :" + s);
            FoodStall FS = new FoodStall();
            FS.input();
            statusList.add(FS);
        }
        for (int i = 0; i < 2; i++) {
            int s = i + 1;
            System.out.println("Enter parking:" + s);
            Parking P = new Parking();
            P.input();
            statusList.add(P);
        }
        for (int i = 0; i < 5; i++) {
            int s = i + 1;
            System.out.println("Enter 5 movie room:" + s);
            MovieRoom MR = new MovieRoom();
            MR.input();
            statusList.add(MR);
        }
    }
    static void followStatus(List<IStatus>statusList){
        for (IStatus iStatus : statusList) {
            IStatus.onStatus();
        }
    }
}



/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Film;

/**
 *
 * @author Administrator
 */
public interface IStatus {
    public static void onStatus(){
        
    }
}



/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Film;

import java.util.Scanner;

/**
 *
 * @author Administrator
 */
public class FoodStall implements IStatus{
    static enum FOODSTALL_STATUS{
        VACANT ,FEWCUS,MODERATECUS,VERYCROWDED
    }
    FOODSTALL_STATUS foodstall;
    String moment;
    
    public void input(){
        Scanner scan = new Scanner(System.in);
        
        System.out.println("Nhap moment:");
        moment = scan.nextLine();
        System.out.println("Enter status:");
        System.out.println("1. Enter vacant:");
        System.out.println("2. Enter few customers:");
        System.out.println("3. Enter moderate customers:");
        System.out.println("4. Enter very crowded:");
        System.out.println("Choose:");
        int choose = Integer.parseInt(scan.nextLine());
        switch(choose){
            case 1:
                foodstall = FOODSTALL_STATUS.VACANT;
                break;
            case 2:
                foodstall = FOODSTALL_STATUS.FEWCUS;
                break;
            case 3:
                foodstall = FOODSTALL_STATUS.MODERATECUS;
                break;
            case 4:
                foodstall = FOODSTALL_STATUS.VERYCROWDED;
                break;
            default:
                break;
        }
    }
    
    public void onStatus(){
        System.out.println("FoodStall");
        System.out.println("Moment:" + moment);
        switch(foodstall){
            case VACANT:
                System.out.println("Vacant :");
                break;
            case FEWCUS:
                System.out.println("Few customers");
                break;
            case MODERATECUS:
                System.out.println("Moderate customers"); 
                break;
            case VERYCROWDED:
                System.out.println("Very crowded");
                break;
    }
}
}