最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

大佬交作業(yè)啦,不服來(lái)看。

//?Car.java
public?class?Car?{
????public?String?name;
????public?int?rent_money;
????public?int?capacity_person;
????public?int?capacity_goods;

????public?Car(String?name,?int?rent_money,?int?capacity_person,?int?capacity_goods)?{
????????this.name?=?name;
????????this.rent_money?=?rent_money;
????????this.capacity_person?=?capacity_person;
????????this.capacity_goods?=?capacity_goods;
????}

????public?String?getName()?{
????????return?name;
????}

????public?void?setName(String?name)?{
????????this.name?=?name;
????}

????public?int?getRent_money()?{
????????return?rent_money;
????}

????public?void?setRent_money(int?rent_money)?{
????????this.rent_money?=?rent_money;
????}

????public?int?getCapacity_person()?{
????????return?capacity_person;
????}

????public?void?setCapacity_person(int?capacity_person)?{
????????this.capacity_person?=?capacity_person;
????}

????public?int?getCapacity_goods()?{
????????return?capacity_goods;
????}

????public?void?setCapacity_goods(int?capacity_goods)?{
????????this.capacity_goods?=?capacity_goods;
????}
}
//?SmallCar.java
public?class?SmallCar?extends?Car?{
????public?SmallCar(String?name,?int?rent_money,?int?capacity_person,?int?capacity_goods)?{
????????super(name,?rent_money,?capacity_person,?capacity_goods);
????}
}
//?Bus.java
public?class?Bus?extends?Car?{
????public?Bus(String?name,?int?rent_money,?int?capacity_person,?int?capacity_goods)?{
????????super(name,?rent_money,?capacity_person,?capacity_goods);
????}
}
//?Pick.java
public?class?Pick?extends?Car?{
????public?Pick(String?name,?int?rent_money,?int?capacity_person,?int?capacity_goods)?{
????????super(name,?rent_money,?capacity_person,?capacity_goods);
????}
}
//?Truck.java
public?class?Truck?extends?Car?{
????public?Truck(String?name,?int?rent_money,?int?capacity_person,?int?capacity_goods)?{
????????super(name,?rent_money,?capacity_person,?capacity_goods);
????}
}
//?Test.java
import?java.util.Scanner;

public?class?Test?{
????public?static?void?main(String[]?args)?{
????????System.out.println("歡迎使用噠噠租車(chē)系統(tǒng):");
????????System.out.println("您是否需要租車(chē):1是?0否");

????????int?is_rent?=?0;?//?是否租車(chē)
????????is_rent?=?new?Scanner(System.in).nextInt();
????????if?(is_rent?==?1)?{
????????????System.out.println("您可租車(chē)的類(lèi)型及價(jià)目表:");
????????????Car?cars[]?=?{
????????????????????new?SmallCar("奧迪A4",?500,?4,?0),
????????????????????new?SmallCar("馬自達(dá)6",?400,?4,?0),
????????????????????new?Pick("皮卡雪6",?450,?4,?2),
????????????????????new?Bus("金龍",?800,?20,?0),
????????????????????new?Truck("松花江",?400,?0,?4),
????????????????????new?Truck("依維柯",?1000,?0,?20),
????????????};
????????????System.out.println("序號(hào)?汽車(chē)名稱(chēng)?租金?容量");
????????????for?(int?i?=?0;?i?<?cars.length;?i++)?{
????????????????System.out.println(
????????????????????????i?+?1?+?"?"?+?cars[i].getName()?+?"?"?+?cars[i].getRent_money()?+?"元/天"?+?"?載人:"?+?cars[i].getCapacity_person()
????????????????????????????????+?"人?載貨:"?+?cars[i].getCapacity_goods()?+?"噸"
????????????????);
????????????}

????????????System.out.println("請(qǐng)輸入您要租賃汽車(chē)的數(shù)量");
????????????int?rent_count?=?0;?//?租車(chē)數(shù)量
????????????rent_count?=?new?Scanner(System.in).nextInt();
????????????Car?rent_cars[]?=?new?Car[rent_count];
????????????for?(int?i?=?0;?i?<?rent_count;?i++)?{
????????????????System.out.println("請(qǐng)輸入第"?+?(i?+?1)?+?"輛租賃的汽車(chē)序號(hào)");
????????????????int?number?=?0;?//?租車(chē)序號(hào)
????????????????number?=?new?Scanner(System.in).nextInt();
????????????????rent_cars[i]?=?cars[number?-?1];
????????????}

????????????int?rent_days?=?0;?//?租車(chē)天數(shù)
????????????System.out.println("請(qǐng)輸入您要租賃的天數(shù)");
????????????rent_days?=?new?Scanner(System.in).nextInt();

????????????int?person_count?=?0;?//?總載人數(shù)
????????????int?goods_count?=?0;??//?總載貨數(shù)
????????????int?rent_money_a_day?=?0;?//?租所選擇的所有車(chē)每天的租金

????????????System.out.println("您的賬單:");
????????????System.out.println("*****可載人的車(chē)有:");
????????????for?(int?i?=?0;?i?<?rent_cars.length;?i++)?{
????????????????if?(!(rent_cars[i]?instanceof?Truck))?{
????????????????????System.out.print(rent_cars[i].getName()?+?"?");
????????????????}
????????????????person_count?+=?rent_cars[i].getCapacity_person();
????????????????goods_count?+=?rent_cars[i].getCapacity_goods();
????????????????rent_money_a_day?+=?rent_cars[i].getRent_money();
????????????}

????????????System.out.println("共載人:"?+?person_count?+?"人");

????????????System.out.println("*****可載貨的車(chē)有:");
????????????for?(int?i?=?0;?i?<?rent_cars.length;?i++)?{
????????????????if?((rent_cars[i]?instanceof?Truck)?||?(rent_cars[i]?instanceof?Pick))?{
????????????????????System.out.print(rent_cars[i].getName()?+?"?");
????????????????}
????????????}
????????????System.out.println("共載貨:"?+?goods_count?+?"噸貨");

????????????System.out.println("*****租車(chē)總價(jià)格:"?+?rent_money_a_day?*?rent_days?+?"元");
????????}?else?{
????????????System.out.println("退出噠噠租車(chē)系統(tǒng)");
????????}
????????System.exit(0);

????}
}

http://img1.sycdn.imooc.com/5fb255de0001fa8207741184.jpg

正在回答

1 回答

hjh,代碼借來(lái)看看,謝大佬!


0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消
Java入門(mén)第二季
  • 參與學(xué)習(xí)       531268    人
  • 解答問(wèn)題       6327    個(gè)

課程升級(jí)!以終為始告別枯燥,在開(kāi)發(fā)和重構(gòu)中體會(huì)Java面向?qū)ο缶幊痰膴W妙

進(jìn)入課程

大佬交作業(yè)啦,不服來(lái)看。

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)