limousine

汽车租赁

萝らか妹 提交于 2019-11-28 22:43:09
import java.util.Scanner; class Java继承 { public static void main(String[] args) { Company company = new Company(); company.name = "江工租赁公司"; company.limousine = new Limousine(); company.passengerCar = new PassengerCar(); company.fun(); } } class Company { String name; Limousine limousine; PassengerCar passengerCar; public void fun(){ System.out.println("\t\t欢迎你拉来到"+name); System.out.println("\n\n本公司有:\n1.轿车\n2.客车"); System.out.println("\n温馨提醒:输入1或2即可"); Scanner sc = new Scanner(System.in); System.out.print("\n请输入你想租赁的车种: "); int car = sc.nextInt(); switch(car){ case 1 : limousine.l();break;