模拟售票系统
发布时间: 2024-12-08 02:07:25
㈠ 求大神帮忙做一下:模拟火车站售票系统
abstract IdCard{
void say();
}
class PersonIdCard extends IdCard(){
public void say(){
System.out.println("这是用身份证购买火车票");
}
}
class StudentIdCard extends IdCard(){
public void say(){
System.out.println("这是用学生证购买火车票");
}
}
class Ticket{
public static int prise=80;
public station String destnation;
}
class Station{
public Ticket shoupiao(IdCard idCard,Date date,String destnation){
if(idCard instanceof PersonIdCard){
Ticket.prise=80;
Ticket.destnation=destnation;
}else{
Ticket.prise=40;
Ticket.destnation=destnation;
}
}
}
哥,测试类你自己写吧