java汽车租赁系统.docVIP

  • 4
  • 0
  • 约1.79千字
  • 约 9页
  • 2021-09-26 发布于山东
  • 举报
java汽车租赁系统 java汽车租赁系统 PAGE / NUMPAGES java汽车租赁系统 package RentCar; public class Bus extends MotoVehicle{ private int seatCount ; quals(getBrand())){ rent = days * 500; } else if ( 丰田 .equals(getBrand())){ if ( GL8)){ rent = days * 600; } else { rent = days * 300; } } return rent; } } package RentCar; public class Customer { private String name; public Customer(){ } public Customer(String name){ = name; } public String getName(){ return name; } public int calcTotalRent(MotoVehicle[] moto, int days){ int rent = 0 ; for ( int i = 0 ;i ; i++){ if (moto[i]!= null ){ rent = rent + moto[i].calRent(days); } } return rent; } } package RentCar; public abstract class MotoVehicle { private String no; 2. ); motoType = (); int random = ( int )()*(99999-10000)+10000); switch (motoType){ case 1: no = 粤A + random; 马 2. 丰田): ); if () == 1){ brand = 宝马; type = 320i ; } else { brand = 丰田; type = RAV4; } 海 2. 金龙): ); 根据选择得到汽车品牌 if () ==1){ brand = 黄海 ; } else { brand = 金龙 ; } 请输入客车的座位数: ); seat = (); // 汽车座位数 // 实例化一个轿车对象 , 并添加到 moto数组中 for ( int i = 0 ; i ;i ++){ if (moto[i] == null ){ moto[i] = new Bus(no,brand,seat); // 实例 化一个汽车对象 break ; } } break ; } 是否继续租车( y/n ): ); answer = (); } while ( y )); 汽车牌号 \t 汽车品牌 ); for ( int i = 0 ; i ;i ++){ if (moto[i] != null ){ if (moto[i] instanceof Car){ Car c = (Car)moto[i]; \t +()); } else { Bus b = (Bus)moto[i]; \t +()); } } } +()+ , +days+, +(moto, days)); } } package RentCar; public class Truck extends MotoVehicle { private int weight ; // public Truck(){ } public Truck(String no, String brand, int weight){ super (no,brand); = weight; } public int getWeight(){ return weight ; } public int calRent( int days){ int rent = 0; rent = weight * 50 * days; return rent; } }

文档评论(0)

1亿VIP精品文档

相关文档