Commit 73890f6c authored by mrsl2000's avatar mrsl2000

oh god javadoc

parents
package Alibaba;
import Alibaba.*;
/**
* flight class is class that simulate the flight information
* @author mohammadreza
* @version 1.0
*/
public class Flight {
private String day;
private int hour;
private String I;// starting point
private String F;// finishing point
private String company;
private Plane plane;
private int number;
public Flight(String day, int hour, String I, String F, String company, Plane plane, int number) {
super();
this.day = day;
this.hour = hour;
this.I = I;
this.F = F;
this.company = company;
this.plane = plane;
this.number = number;
}
/**
* This is a getter method!
* @author mohammadreza
* @return the day
*/
public String getDay() {
return day;
}
/**
* this is a setter method
* @author mohammadreza
* @param day the day to set
*/
public void setDay(String day) {
this.day = day;
}
/**
* This is a getter method!
* @author mohammadreza
* @return the hour
*/
public int getHour() {
return hour;
}
/**
* this is a setter method
* @author mohammadreza
* @param hour the hour to set
*/
public void setHour(int hour) {
this.hour = hour;
}
/**
* This is a getter method!
* @author mohammadreza
* @return the i
*/
public String getI() {
return I;
}
/**
* this is a setter method
* @author mohammadreza
* @param i the i to set
*/
public void setI(String i) {
I = i;
}
/**
* This is a getter method!
* @author mohammadreza
* @return the f
*/
public String getF() {
return F;
}
/**
* this is a setter method
* @author mohammadreza
* @param f the f to set
*/
public void setF(String f) {
F = f;
}
/**
* This is a getter method!
* @author mohammadreza
* @return the company
*/
public String getCompany() {
return company;
}
/**
* this is a setter method
* @author mohammadreza
* @param company the company to set
*/
public void setCompany(String company) {
this.company = company;
}
/**
* This is a getter method!
* @author mohammadreza
* @return the plane
*/
public Plane getPlane() {
return plane;
}
/**
* this is a setter method
* @author mohammadreza
* @param plane the plane to set
*/
public void setPlane(Plane plane) {
this.plane = plane;
}
/**
* This is a getter method!
* @author mohammadreza
* @return the number
*/
public int getNumber() {
return number;
}
/**
* this is a setter method
* @author mohammadreza
* @param number the number to set
*/
public void setNumber(int number) {
this.number = number;
}
}
package Alibaba;
import Alibaba.*;
import java.util.ArrayList;
/**
* this class is a simulation of airplane and the seats of it
* @author mohammadreza
* @version 1.0
*/
public class Plane {
private String type;
private ArrayList<Seat> seats;
/**
* This is a getter method!
* @author mohammadreza
* @return the type
*/
public String getType() {
return type;
}
/**
* this is a setter method
* @author mohammadreza
* @param type the type to set
*/
public void setType(String type) {
this.type = type;
}
/**
* This is a getter method!
* @author mohammadreza
* @return the seats
*/
public ArrayList<Seat> getSeats() {
return seats;
}
/**
* this is a setter method
* @author mohammadreza
* @param seats the seats to set
*/
public void setSeats(ArrayList<Seat> seats) {
this.seats = seats;
}
public Plane (String type , int ecoNum, int firstnum , int businessNum){
setType(type);
seats = new ArrayList<>();
for (int i = 0 ; i<ecoNum+firstnum+businessNum ; i++){
if(i<ecoNum){
Seat s = new Seat(i , "eco");
seats.add(s);
}else if (i <ecoNum+firstnum){
Seat s = new Seat(i , "firstClass");
seats.add(s);
}else{
Seat s = new Seat(i , "business");
seats.add(s);
}
}
}
/**
* showAllSeats show us the every seats in plane
* @author mohammadreza
*/
public void showAllSeats(){
for (Seat s : seats) {
java.lang.System.out.println(s.getNum()+","+s.getType());
}
}
/**
* showFreeSeats show user were he can sit
* @author mohammadreza
*/
public void showFreeSeats(){
for (Seat s : seats) {
if (!s.getDiscription()) java.lang.System.out.println(s.getNum()+","+s.getType());
}
}
}
package Alibaba;
/**
* this class modeling seats in the airplane
* @author mohammadreza
* @version 1.0
*/
public class Seat {
private boolean discription; // seat is free or reserved
private String type ;
private int num ;
/**
* @author mohammadreza
* @param discription is false at the first
* @param type is first class or not
* @param num to set the number of seat
*/
public Seat(String type, int num) {
this.discription = false;//free
this.type = type;
this.num = num;
}
/**
* This is a getter method!
* @author mohammadreza
* @return the discription
*/
public boolean isDiscription() {
return discription;
}
/**
* this is a setter method
* @author mohammadreza
* @param discription the discription to set
*/
public void setDiscription(boolean discription) {
this.discription = discription;
}
/**
* This is a getter method!
* @author mohammadreza
* @return the type
*/
public String getType() {
return type;
}
/**
* this is a setter method
* @author mohammadreza
* @param type the type to set
*/
public void setType(String type) {
this.type = type;
}
/**
* This is a getter method!
* @author mohammadreza
* @return the num
*/
public int getNum() {
return num;
}
/**
* this is a setter method
* @author mohammadreza
* @param num the num to set
*/
public void setNum(int num) {
this.num = num;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment