public class DPXT {
String checi;
String site;
String departtime;
String arrivetime;
String passtime;
public DPXT(String checi,String site,String departtime,String arrivetime,String passtime){
this.checi = checi;
this.site = site;
this.departtime = departtime;
this.arrivetime = arrivetime;
this.passtime = passtime;
}
@Override
public String toString() {
return checi+" "+site+" "+departtime+" "+arrivetime+" "+passtime;
}
public void SC(){
System.out.println();
}
public String getCheci() {
return checi;
}
public String getSite() {
return site;
}
public String getDeparttime() {
return departtime;
}
public String getArrivetime() {
return arrivetime;
}
public String getPasstime() {
return passtime;
}
public static void main(String[] args) {
QQ();
}
public static void QQ(){
DPXT dpxt1 = new DPXT("T40", "长春-北京", "00:12","12:20","12:08");
DPXT dpxt2 = new DPXT("T298", "长春-北京", "00:06","10:50","10:44");
DPXT dpxt3 = new DPXT("Z158", "长春-北京", "12:48","21:06","08:18");
System.out.println("车次 出发站-到达站 出发时间 到达时间 历时");
System.out.println(dpxt1);
System.out.println(dpxt2);
System.out.println(dpxt3);
System.out.println("请输入要购买的车次:");
String s = new Scanner(System.in).nextLine();
System.out.println(s);
System.out.println("请输入乘车人");
String n = new Scanner(System.in).nextLine();
String m = new Scanner(System.in).nextLine();
System.out.println(n+","+m);
if (s.equals(dpxt1.checi)) {
System.out.println("您已购"+dpxt1.checi+"次列车"+dpxt1.site+dpxt1.departtime+"开"+","+"请"+n+","+m+"尽快换取纸质车票");
}
}
}
|