import java.util.Vector;
public class MajorCineplex {
private String theatreMajor;
public MajorCineplex(String theatreMajor) {
this.theatreMajor = theatreMajor;
}
public String getTheatreMajor() {
return theatreMajor;
}
public String toString() {
return " " + getTheatreMajor();
}
}
Code (Java)
import java.util.Scanner;
import java.util.Vector;
public class Theatre extends MajorCineplex {
private String nameTheatre;
private int numberTheatre;
private int numberRow;
private int numberSeat;
private Vector<Movies> movies = new Vector<Movies>();
public Theatre(String theatreMajor, String nameTh) {
super(theatreMajor);
this.nameTheatre = nameTh;
}
public String getNameTheatre() {
return nameTheatre;
}
public int getNumberTheatre() {
return numberTheatre;
}
public void addMovies(Movies m) {
movies.addElement(m);
}
public void listMovies() {
int number;
Scanner scan = new Scanner(System.in);
System.out.print(" ต้องการสาขา ? : = ");
number = scan.nextInt();
System.out.println("\t \t \t ::: เมเจอร์ ซีนีเพล็กซ์ เซ็นทรัลเฟสติวัล เชียงใหม่ ::: ");
System.out.println("MOVIE TITLE " + " \t \t \t DATE "
+ " \t\tSHOWTIME " + "\t\tTHEATRE ");
for (int i = 0; i < movies.size(); i++) {
if (number == 1) {
System.out.println("" + movies.elementAt(i).getNameMovies()
+ " \t\t" + movies.elementAt(i).getDate()
+ "\t\t " + movies.elementAt(i).getTime()
+ "\t\t\t " + movies.elementAt(i).getTheatre());
}
}
}
public void Theatre() {
Scanner scan = new Scanner(System.in);
System.out.println("");
}
public String toString() {
return "\tสาขา " + getNameTheatre();
}
}
Code (Java)
public class Movies extends MajorCineplex {
private String nameMovies;
private String date;
private String time;
private int theatre;
public Movies(String theatreMajor, String nameMovies, String date,
String time, int theatre) {
super(theatreMajor);
this.nameMovies = nameMovies;
this.date = date;
this.time = time;
this.theatre = theatre;
}
public String getNameMovies() {
return nameMovies;
}
public String getDate() {
return date;
}
public String getTime() {
return time;
}
public int getTheatre() {
return theatre;
}
public String toString() {
return "ภาพยนตร์ " ;
}
}
Code (Java)
import java.util.Scanner;
public class Run {
public static void main(String[] args) {
System.out.println("\t \t \t ******* Major Cineplex *******");
Scanner scan = new Scanner(System.in);
MajorCineplex ma = new MajorCineplex("\b ภาคเหนือ - เชียงใหม่ ");
Theatre t1 = new Theatre("ภาคเหนือ - เชียงใหม่","1.เมเจอร์ ซีนีเพล็กซ์ เซ็นทรัลเฟสติวัล เชียงใหม่");
Theatre t2 = new Theatre("ภาคเหนือ - เชียงใหม่","2.เมเจอร์ ซีนีเพล็กซ์ เซ็นทรัล เชียงใหม่ แอร์พอร์ต");
Movies m1 = new Movies("ภาคเหนือ","Single lady เพราะเคยมีแฟน","12/02/2015","11:30",1);
Movies m2 = new Movies("ภาคเหนือ","Single lady เพราะเคยมีแฟน","12/02/2015","14:50",1);
Movies m3 = new Movies("ภาคเหนือ","Single lady เพราะเคยมีแฟน","12/02/2015","18:10",1);
Movies m4 = new Movies("ภาคเหนือ","Single lady เพราะเคยมีแฟน","12/02/2015","21:30",1);
Movies m5 = new Movies("ภาคเหนือ","American Sniper","12/02/2015","10:00",2);
Movies m6 = new Movies("ภาคเหนือ","American Sniper","12/02/2015","12:30",2);
Movies m7 = new Movies("ภาคเหนือ","American Sniper","12/02/2015","17:20",2);
Movies m8 = new Movies("ภาคเหนือ","American Sniper","12/02/2015","20:10",2);
Movies m9 = new Movies("ภาคเหนือ","Jupiter Ascending","12/02/2015","13:30",3);
Movies m10 = new Movies("ภาคเหนือ","Jupiter Ascending","12/02/2015","16:20",3);
Movies m11 = new Movies("ภาคเหนือ","Jupiter Ascending","12/02/2015","19:10",3);
Movies m12 = new Movies("ภาคเหนือ","Jupiter Ascending","12/02/2015","22:00",3);
Movies m13 = new Movies("ภาคเหนือ","The Imitation Game","12/02/2015","12:50",4);
Movies m14 = new Movies("ภาคเหนือ","The Imitation Game","12/02/2015","15:40",4);
Movies m15 = new Movies("ภาคเหนือ","The Imitation Game","12/02/2015","18:30",4);
Movies m16 = new Movies("ภาคเหนือ","The Imitation Game","12/02/2015","21:20",4);
Movies m17 = new Movies("ภาคเหนือ","Sean Sa Yong เศียรสยอง","12/02/2015","11:00",5);
System.out.println(ma.toString());
System.out.println(t1.toString());
System.out.println(t2.toString());
t1.addMovies(m1);
t1.addMovies(m2);
t1.addMovies(m3);
t1.addMovies(m4);
t1.addMovies(m5);
t1.addMovies(m6);
t1.addMovies(m7);
t1.addMovies(m8);
t1.addMovies(m9);
t1.addMovies(m10);
t1.addMovies(m11);
t1.addMovies(m12);
t1.addMovies(m13);
t1.addMovies(m14);
t1.addMovies(m15);
t1.addMovies(m16);
t1.addMovies(m17);
t1.listMovies();
}
}