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

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

關(guān)于答答租車系統(tǒng),求助

關(guān)于答答租車系統(tǒng),求助

剛剛看完java入門第二季的視頻,嘗試著寫了一下答答租車系統(tǒng),但是運(yùn)行時出錯,各位大神幫幫忙看一下吧。(最后求和和輸出還差點(diǎn),但是應(yīng)該不影響運(yùn)行,只是輸出的不一樣),以下是我的代碼: //車的類我貼上了貨車的,其他的幾個類都差不多。 主類: package?Test; import?java.util.*; public?class?Test?{ public?static?void?main(String[]?args)?{ //?TODO?Auto-generated?method?stub int?sum?=?0; Car[]?cars?=?{ new?jiaoche(1,"奧迪A4",500,4), new?jiaoche(2,"馬自達(dá)6",400,4), new?all(3,"皮卡雪6",450,4,2), new?jiaoche(4,"金龍?????????",800,20), new?huoche(5,"松花江",400,4), new?huoche(6,"依維柯",1000,20) }; System.out.println("是否進(jìn)入租車系統(tǒng)(1:是??2:否)"); Scanner?reader?=?new?Scanner(System.in); if(reader.nextInt()?==?2){ System.out.println("再見"); System.exit(0); } reader.close(); System.out.println("可供您選擇的車輛:"); System.out.println("序號????車名???????????價格?????????????載重"); ((jiaoche)cars[0]).show(); ((jiaoche)cars[1]).show(); ((all)cars[2]).show(); ((jiaoche)cars[3]).show(); ((huoche)cars[4]).show(); ((huoche)cars[5]).show(); System.out.println("請輸入您需要的車輛數(shù):"); Scanner?num?=?new?Scanner(System.in); for(int?i?=?0;i?<?num.nextInt();i++){ System.out.println("請輸入第"+i+"輛車序號:"); Scanner?x?=?new?Scanner(System.in); sum?+=?cars[x.nextInt()].getCoin(); x.close(); } num.close(); System.out.println("*****您共需要支付"+sum+"元"); } }貨車類:package Test;public class huoche extends Car{ private int zh; public int getZh() { return zh; } public void setZh(int zh) { this.zh = zh; } public void show(){ System.out.println(getId()+" ? ?"+getName()+" ? ?"+getCoin()+ "元/天 ? ? 載物(噸):"+getZh()); } public huoche(int id,String name,int coin,int zh) { // TODO Auto-generated method stub this.setId(id); this.setName(name); this.setCoin(coin); this.setZh(zh); }}
查看完整描述

1 回答

  • 1 回答
  • 2 關(guān)注
  • 1741 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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