第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

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

交作業(yè):嗒嗒租車系統(tǒng)

package?com.imooc;
public?class?Che?{
?private?String?carName;
?private?int?carPrice;
?private?int?carPCapacity;
?private?int?carGCapacity;
?
?public?String?getCarName()?{
??return?carName;
?}
?public?void?setCarName(String?carName)?{
??this.carName?=?carName;
?}
?public?int?getCarPrice()?{
??return?carPrice;
?}
?public?void?setCarPrice(int?carPrice)?{
??this.carPrice?=?carPrice;
?}
?public?int?getCarPCapacity()?{
??return?carPCapacity;
?}
?public?void?setCarPCapacity(int?carPCapacity)?{
??this.carPCapacity?=?carPCapacity;
?}
?public?int?getCarGCapacity()?{
??return?carGCapacity;
?}
?public?void?setCarGCapacity(int?carGCapacity)?{
??this.carGCapacity?=?carGCapacity;
?}
}
package?com.imooc;
public?class?HuoChe?extends?Che?{
?private?int?carPCapacity;
?
?public?HuoChe(String?carName,?int?carPrice?,int?carGCapacity)?{
??this.setCarName(carName);
??this.setCarPrice(carPrice);
??this.setCarPCapacity();
??this.setCarGCapacity(carGCapacity);
?}
?public?int?getCarPCapacity()?{
??return?carPCapacity;
?}
?public?void?setCarPCapacity()?{
??this.carPCapacity?=?0;
?}
}
package?com.imooc;
public?class?KeChe?extends?Che?{
?private?int?carGCapacity;
?
?public?KeChe(String?carName,?int?carPrice,?int?carPCapacity)?{
??this.setCarName(carName);
??this.setCarPrice(carPrice);
??this.setCarPCapacity(carPCapacity);
??this.setCarGCapacity();
?}
?public?int?getCarGCapacity()?{
??return?carGCapacity;
?}
?public?void?setCarGCapacity()?{
??this.carGCapacity?=?0;
?}
}
package?com.imooc;
public?class?PiKa?extends?Che?{
?
?public?PiKa(String?carName,?int?carPrice,?int?carPCapacity,?int?carGCapacity)?{
??this.setCarName(carName);
??this.setCarPrice(carPrice);
??this.setCarPCapacity(carPCapacity);
??this.setCarGCapacity(carGCapacity);
?}
}
package?com.imooc;
import?java.util.Scanner;
public?class?Test?{
?
?static?KeChe?k1?=?new?KeChe("奧迪A4",?500,?4);
?static?KeChe?k2?=?new?KeChe("馬自達(dá)6",?400,?4);
?static?KeChe?k3?=?new?KeChe("金龍",?800,?20);
?static?HuoChe?h1?=?new?HuoChe("松花江",?400,?4);
?static?HuoChe?h2?=?new?HuoChe("依維柯",?1000,?20);
?static?PiKa?p1?=?new?PiKa("皮卡雪6",?450,?4?,2);
?
?static?Che[]?ches?=?{null,?k1,?k2,?k3,?h1,?h2,?p1};
?
?private?static?int?totalPrice?=?0;
?private?static?int?totalPCapacity?=?0;
?private?static?int?totalGCapacity?=?0;
?
?public?static?void?main(String[]?args)?{
??Test?test?=?new?Test();
??boolean?boo?=?true;
??
??System.out.println("歡迎使用嗒嗒租車系統(tǒng)");
??
??for(?;?boo;?)?{
???
???System.out.println("1.進(jìn)入系統(tǒng)\n2.退出系統(tǒng)");
???Scanner?system?=?new?Scanner(System.in);
???int?str?=?system.nextInt();
???
???if(str?==?1)?{
????System.out.println("您可租用的車輛信息如下");
????System.out.println("序號(hào)\t車名\t租金(元/天)\t載人(人)\t載貨(噸)");
????test.printCarInfo();
????
????System.out.println("請(qǐng)輸入您想租用車輛的數(shù)目");
????int?rentNum?=?new?Scanner(System.in).nextInt();
????Che[]?totalChe?=?new?Che[rentNum?+?1];
????totalChe[0]?=?null;
????
????for(int?num?=?0;?num?<?rentNum;?num++)?{
?????System.out.println("請(qǐng)輸入第?"?+?(num?+?1)?+?"?輛車的序號(hào)\t");
?????int?carNo?=?new?Scanner(System.in).nextInt();
?????
?????totalChe[(num?+?1)]?=?ches[carNo];
?????totalPrice?=?totalPrice?+?ches[carNo].getCarPrice();
?????totalPCapacity?=?totalPCapacity?+?ches[carNo].getCarPCapacity();
?????totalGCapacity?=?totalGCapacity?+?ches[carNo].getCarGCapacity();
????}
????
????System.out.println("請(qǐng)輸入租用天數(shù)");
????int?rentDay?=?new?Scanner(System.in).nextInt();
????
????System.out.println("您租用的車輛信息如下");
????System.out.println("序號(hào)\t車名\t租金(元/天)\t載人(人)\t載貨(噸)");
????for(int?i?=?1;?i?<?rentNum?+?1;?i++)?{
?????System.out.print(i?+?"\t");
?????System.out.print(totalChe[i].getCarName()?+?"\t");
?????System.out.print(totalChe[i].getCarPrice()?+?"\t\t");
?????System.out.print(totalChe[i].getCarPCapacity()?+?"\t");
?????System.out.print(totalChe[i].getCarGCapacity()?+?"\t");
?????System.out.println();
????}
????
????System.out.println("總租金為?"?+?totalPrice?*?rentDay?+?"?元");
????System.out.println("可載人數(shù)為?"?+?totalPCapacity?+?"?人");
????System.out.println("可載貨物為?"?+?totalGCapacity?+?"?噸");
????
????boo?=?false;
???}?else?if(str?==?2){
????System.out.println("很遺憾,期待您的下次使用");
????boo?=?false;
???}?else?{
????System.out.println("您的輸入有誤,請(qǐng)重新輸入");
???}
??}
?}
?
?public?void?printCarInfo()?{
??
??for(int?i?=?1;?i?<?ches.length;?i++)?{
???System.out.print(i?+?"\t");
???System.out.print(ches[i].getCarName()?+?"\t");
???System.out.print(ches[i].getCarPrice()?+?"\t\t");
???System.out.print(ches[i].getCarPCapacity()?+?"\t");
???System.out.print(ches[i].getCarGCapacity()?+?"\t");
???System.out.println();
??}
?}
}

正在回答

4 回答

test.printCarInfo(); 這是什么意思 哪里來(lái)的這方法

0 回復(fù) 有任何疑惑可以回復(fù)我~
很好很強(qiáng)大

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

我想問(wèn)一下,static?Che[]?ches?=?{null,?k1,?k2,?k3,?h1,?h2,?p1};數(shù)組前面的null是什么?求大神指導(dǎo)

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

victor_Lau

代表 0啊
2016-07-27 回復(fù) 有任何疑惑可以回復(fù)我~

漂亮。。漂亮。。。漂亮 ? ?用接口 也行吧

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

舉報(bào)

0/150
提交
取消

交作業(yè):嗒嗒租車系統(tǒng)

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

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

幫助反饋 APP下載

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

公眾號(hào)

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