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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

從輸入您要租車額數(shù)量開始就有好多問(wèn)題不懂的,求指導(dǎo)!可以加微信指導(dǎo)指導(dǎo)我嗎

從輸入您要租車額數(shù)量開始就有好多問(wèn)題不懂的,求指導(dǎo)!可以加微信指導(dǎo)指導(dǎo)我嗎

慕萊塢1282154 2017-10-10 11:05:43
package com.carsystem;import java.util.*;public class RentSystem {Car cars[] ={new PassengerCar("奧迪A4",500,4),new PassengerCar("馬自達(dá)",400,4),new Pickup("皮卡雪",450,2,4),new PassengerCar("金龍",800,20),new GoodsVan("松花江",400,4),new GoodsVan("依維柯",1000,20)};?int count;?int day;?int money;Car[] rent = new Car[100];static Scanner input = new Scanner(System.in);public static void main(String[] args) {RentSystem hello = new RentSystem();System.out.println("歡迎使用答答租車系統(tǒng):");System.out.println("您是否要租車:1 是 0 否");int select = input.nextInt();if(select==0){ input.close(); System.exit(-1); }System.out.println("您可租車的類型及其價(jià)目表:"); System.out.println("序號(hào) 汽車名稱 租金 容量");System.out.println("1. 奧迪A4 500/天 載人:4人"); System.out.println("2. 馬自達(dá) 400/天 載人:4人"); System.out.println("3. 皮卡雪 450/天 載人:4人,載貨:2噸"); System.out.println("4. 金龍 800/天 載人:20人"); System.out.println("5. 松花江 500/天 載貨:4噸"); System.out.println("6. 依維柯 1000/天 載貨:20噸"); System.out.println("請(qǐng)輸入您要租車額數(shù)量:");int rentNum = input.nextInt();for(int i=0;i<rentNum;i++){?System.out.println("您要租的第"+(i+1)+"輛車的序號(hào)");?int a = input.nextInt();while(a<1||a>6){System.out.println("您輸入的數(shù)據(jù)有問(wèn)題,請(qǐng)重新輸入");int b = input.nextInt();a=b; }int p = hello.cars[a-1].price;hello.money +=p;hello.rent[i] = hello.cars[a-1];}System.out.println("您要租車的天數(shù):");int c = input.nextInt();hello.money*=c;System.out.println("您的租車賬單");int loadAmount =0;int passengerAmount =0;for(int i=0;i<rentNum;i++){System.out.print(hello.rent[i].name+" "); loadAmount+=hello.rent[i].load;passengerAmount+=hello.rent[i].pNum;}?System.out.println();System.out.println("您的租車載人數(shù)量"+passengerAmount+"人"); System.out.println("您的租車載貨量"+loadAmount+"噸"); System.out.println("您的租車總費(fèi)用:"+hello.money); } }
查看完整描述

1 回答

?
Developer_Zuck

TA貢獻(xiàn)112條經(jīng)驗(yàn) 獲得超42個(gè)贊

是對(duì)代碼部分不懂還是絕大部分不懂。如果部分不懂,可以寫出你不懂的點(diǎn),這里一樣可以逐一幫你解答。如果基本不懂,那么需要補(bǔ)習(xí)Java基礎(chǔ)知識(shí)了

查看完整回答
反對(duì) 回復(fù) 2017-10-10
  • 慕萊塢1282154
    慕萊塢1282154
    hello.money +=p; hello.rent[i] = hello.cars[a-1]; 你好 這段代碼部太懂,money是哪里來(lái)的,還有rent【i】哪里來(lái)的呢 謝謝啦
  • Developer_Zuck
    Developer_Zuck
    在 RentSystem 類里面有定義int money;(money屬性)當(dāng)創(chuàng)建了RentSystem hello = new RentSystem();這個(gè)對(duì)象的時(shí)候,可以使用對(duì)象.屬性的方式。 rent是一個(gè)數(shù)組,代碼里面:Car[] rent = new Car[100];rent是一個(gè)數(shù)組,i在循環(huán)里面作為變量,所在循環(huán)里面rent【i】在動(dòng)態(tài)取數(shù)組rent的值
  • 1 回答
  • 0 關(guān)注
  • 1042 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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