⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 economyclass.java

📁 飞机自动订票系统有JAVA SWING 实现gui 主要包括booking system seats, class 等
💻 JAVA
字号:
/* Generated by Together */
import java.io.*;
public class EconomyClass {
    public EconomyClass() {
        this.noOfColumn=0;
        this.noOfRow=0;
        this.noOfleft=0;
        this.noOfright=0;
        this.noOfmiddle=0;
        this.className="";
        myseats=new Seats[noOfRow][noOfColumn];
    }
     public EconomyClass(String className,int noOfRow,int noOfColumn,int noOfleft,int noOfright,int noOfmiddle) {
		this.className=className;
        this.noOfRow=noOfRow;
        this.noOfColumn=noOfColumn;
        this.noOfleft=noOfleft;
        this.noOfright=noOfright;
        this.noOfmiddle=noOfmiddle;
        myseats=new Seats[noOfRow][noOfColumn];
        setSeats();
    }

     
    public void setSeats()
    {
        for (int i = 0; i < noOfRow; i++) {
            for (int j = 0; j < noOfColumn; j++) {
                if ((j == 0) || (j == noOfColumn - 1)) {
                    // message #1.1.1.1.1 to <unnamed>:Seats
                    myseats[i][j] = new Seats(i, j, "window");
                }
                else {
                    if (((j == noOfleft - 1) || (j == noOfleft) || (j == noOfleft + noOfmiddle - 1) ||(j==noOfleft+noOfright)||
                        (j == noOfleft + noOfmiddle)||(j==this.noOfmiddle-1)||(j==this.noOfmiddle)||(j==noOfright-1)||(j==noOfright)||j==(noOfmiddle+noOfright-1))) {
                            // message #1.1.1.2.1 to <unnamed>:Seats
                           myseats[i][j] = new Seats(i, j, "aisle");
                    }
                   /* else {
                        // message #1.1.1.3.1 to <unnamed>:Seats
                       myseats[i][j] = new Seats(i, j, "");
                    }*/
                }
            }
        }
    }

    public String getClassName(){ return className; }

    public void setClassName(String className){ this.className = className; }

    public int getNoOfRow(){
        return noOfRow;
    }

    public void setNoOfRow(int noOfRow){
            this.noOfRow= noOfRow;
        }

    public int getNoOfColumn(){
        return noOfColumn;
    }

    public void setNoOfColumn(int noOfColumn){
            this.noOfColumn= noOfColumn;
        }

    public int getNoOfleft(){
        return noOfleft;
    }

    public void setNoOfleft(int noOfleft){
            this.noOfleft= noOfleft;
        }

    public int getNoOfright(){
        return noOfright;
    }

    public void setNoOfright(int noOfright){
            this.noOfright= noOfright;
        }

    public int getNoOfmiddle(){
        return noOfmiddle;
    }

    public void setNoOfmiddle(int noOfmiddle){
            this.noOfmiddle= noOfmiddle;
        }

    public String toString() {
        String out=className+"\n";
        for(int i=0; i<noOfRow;i++){
            for(int j=0; j<noOfColumn; j++){
                out+=myseats[i][j]+"  ";
            }
            out+="\n";
        }
	return out;

    }

    public void writeEconomyClassToFile(BufferedWriter out)throws IOException {
		String end="\n";
        try{
            out.write(className+end);
            out.write(noOfRow+end);
			out.write(noOfColumn+end);
            out.write(noOfleft+end);
            out.write(noOfright+end);
			out.write(noOfmiddle+end);
            for(int i=0;i<noOfRow;i++)
            {
                for(int j=0;j<noOfColumn;j++)
                {
                    this.myseats[i][j].writeSeatsToFile(out);
                }
                out.write(end);
            }
        }catch(IOException e){}
    }
    protected Seats[][] myseats;
    protected String className;
    protected int noOfRow;
    protected int noOfColumn;
    protected int noOfleft;
    protected int noOfright;
    protected int noOfmiddle;
	public Seats getMyseats(int x,int y) {
		return myseats[x][y];
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -