//对电影信息进行封装
public class movie {
    private int id;             //编号
    private String title;      //片名
    private String time;        //时间
    private double score;       //评分
    private String area;        //地区
    private String trpe;       //类型
    private String director;   //导演
    private String starring;    //主演

    public movie() {
    }

    public movie(int id, String title, String time, double score, String area, String trpe, String director, String starring) {
        this.id = id;
        this.title = title;
        this.time = time;
        this.score = score;
        this.area = area;
        this.trpe = trpe;
        this.director = director;
        this.starring = starring;
    }

    /**
     * 获取
     * @return id
     */
    public int getId() {
        return id;
    }

    /**
     * 设置
     * @param id
     */
    public void setId(int id) {
        this.id = id;
    }

    /**
     * 获取
     * @return title
     */
    public String getTitle() {
        return title;
    }

    /**
     * 设置
     * @param title
     */
    public void setTitle(String title) {
        this.title = title;
    }

    /**
     * 获取
     * @return time
     */
    public String getTime() {
        return time;
    }

    /**
     * 设置
     * @param time
     */
    public void setTime(String time) {
        this.time = time;
    }

    /**
     * 获取
     * @return score
     */
    public double getScore() {
        return score;
    }

    /**
     * 设置
     * @param score
     */
    public void setScore(double score) {
        this.score = score;
    }

    /**
     * 获取
     * @return area
     */
    public String getArea() {
        return area;
    }

    /**
     * 设置
     * @param area
     */
    public void setArea(String area) {
        this.area = area;
    }

    /**
     * 获取
     * @return trpe
     */
    public String getTrpe() {
        return trpe;
    }

    /**
     * 设置
     * @param trpe
     */
    public void setTrpe(String trpe) {
        this.trpe = trpe;
    }

    /**
     * 获取
     * @return director
     */
    public String getDirector() {
        return director;
    }

    /**
     * 设置
     * @param director
     */
    public void setDirector(String director) {
        this.director = director;
    }

    /**
     * 获取
     * @return starring
     */
    public String getStarring() {
        return starring;
    }

    /**
     * 设置
     * @param starring
     */
    public void setStarring(String starring) {
        this.starring = starring;
    }
}
import java.util.Scanner;
public class movieService {
    Scanner sc=new Scanner(System.in);
    private movie[] movies;
    public movieService(movie[] movies) {
        this.movies=movies;
    }
    /**启动电影信息管理系统*/
    public void start() {
        lo:
        while (true) {
            System.out.println("-------电影信息系统--------");
            System.out.println("请输入你的选择:");
            System.out.println("1.查询全部电影");
            System.out.println("2.根据id查询电影信息");
            System.out.println("3.退出");
            int choice=sc.nextInt();
            switch (choice){
                case 1:
                    queryAllMovieInformation();
                    break;
                case 2:
                    queryAllMovieId();
                    break;
                case 3:
                    System.out.println("感谢你的使用!");
                    break lo;
                default:
                    System.out.println("输入有误,请检查;");
                    break;
            }
        }
    }

    /**
     * 根据电影编号查询出某个电影的详细信息
     */
    private void queryAllMovieId() {
        System.out.println("请输入电影编号:");
        int id=sc.nextInt();
        for (int i = 0; i < movies.length; i++) {
            movie movie=movies[i];
            if (movie.getId()==id){
                System.out.println(movie.getId()+"--"+movie.getTitle()+"--"+movie.getTime()
                        +"--"+movie.getScore()+"--"+movie.getArea()+"--"+movie.getTrpe()
                +"--"+movie.getDirector()+"--"+movie.getStarring());
                return;
            }
        }
        System.out.println("你的输入有误,请检查!");
    }

    /**
     * 展示系统中电影的全部信息(名称,评分)
     */
    private void queryAllMovieInformation() {
        for (int i = 0; i < movies.length; i++) {
            movie movie=movies[i];
            System.out.println(movie.getTitle()+movie.getScore());
        }
    }
}
//测试类
public class test {
    public static void main(String[] args) {
        movie Movie1=new movie(1,"东八区的先生们","2022",2.1,"中国大陆","剧情 喜剧","夏睿","张翰 王晓晨");
        movie Movie2=new movie(2,"上海堡垒","2019",2.9,"中国大陆","爱情 战争 科幻","腾华涛","鹿晗 舒淇");
        movie Movie3=new movie(3,"纯净心灵-逐梦演艺圈","2015",2.2,"中国大陆","剧情 喜剧","毕志飞","朱一文 李彦漫");
       movie [] movies={Movie1,Movie2,Movie3};
        movieService MovieService =new movieService(movies);
        MovieService.start();

    }
}