主函数
package come.imooc;
import come.imooc.Car.Buss;
import come.imooc.Car.Dz;
import come.imooc.Car.Goods_car;
import come.imooc.Car.Pick;
public class Zhuhanshu {
public static void main(String[] args) {
Rent rent=new Rent();
rent.Welcome();
rent.Ask();
java.util.Scanner day = new java.util.Scanner(System.in);
int k=day.nextInt();
if(k==1){
Car car=new Car();
Dz car1=car.new Dz();
Buss car2= car.new Buss();
Pick car3= car.new Pick();
Goods_car car4= car.new Goods_car();
System.out.println("请选择您需要的车型:"+'\n'+"1."+car1.name+'\n'+"2."+car2.name+'\n'+"3."+car3.name+'\n'+"4."+car4.name);
System.out.print("请输入您要租用的车型:");
int j=day.nextInt();
System.out.print("请输入您要租用的天数:");
int i=day.nextInt();
int sum=0;
day.close();
String fname = null;
switch(j){
case 1:
fname=car1.name;
sum=i*car1.cost;
break;
case 2:
fname=car2.name;
sum=i*car2.cost;
break;
case 3:
fname=car3.name;
sum=i*car3.cost;
break;
case 4:
fname=car4.name;
sum=i*car4.cost;
break;
default:
System.out.println("请输入正确的车型!");
break;
}
System.out.println("**您选用的车型为:"+fname+'\n'+"租期:"+i+"天"+'\n'+"费用:"+sum+"元**");
}else{
System.out.println("Thank you!");
}
}
}