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

為了賬號安全,請及時綁定郵箱和手機立即綁定

我最后輸出的總價格什么的都是0,為什么。

package com.imooc;

import java.util.*;


public class Test {



public static void main(String[] args) {

// TODO Auto-generated method stub

List<car> cars = new ArrayList<car>();

? ? ? ? ?System.out.println("歡迎來到達達租車系統(tǒng)");

? ? ? ? ?System.out.println("你是否要租車 : 1 是 2 否");

? ? ? ? ?

? ? ? ? ?car aodi=new aodi();

? ? ? ? ?cars.add(aodi);

? ? ? ? ?car jinlong=new jinlong();

? ? ? ? ?cars.add(jinlong);

? ? ? ? ?car mazida=new mazida();

? ? ? ? ?cars.add(mazida);

? ? ? ? ?car pikaxue=new pikaxue();

? ? ? ? ?cars.add(pikaxue);

? ? ? ? ?car song=new song();

? ? ? ? ?cars.add(song);

? ? ? ? ?car yiweike=new yiweike();

? ? ? ? ?cars.add(yiweike);

? ? ? ??

? ? ? ? ?Scanner k = new Scanner(System.in);

? ? ? ? ?int num=k.nextInt();

? ??

? ? ? ? ?if(num==1){

? ? ? ? System.out.println("你可租車得類型及價格表:"+"\n"+"序號"+"\t"+"汽車名稱"+"\t"+"租金"+"\t"+"載人"+"\t"+"容量");

? ? ? ? aodi.Car(1);

? ? ? ? jinlong.Car(2);

? ? ? ? mazida.Car(3);

? ? ? ? pikaxue.Car(4);

? ? ? ? song.Car(5);

? ? ? ? yiweike.Car(6);

? ? ? ? System.out.println("請輸入你要的汽車數(shù)量:");

? ? ? ? Scanner amount=new Scanner(System.in);

? ? ? ? int b=amount.nextInt();

? ? ? ? int c;

? ? ? ? int allmanned=0;

? ? ? ? int allcargo=0;

? ? ? ? int allrent=0;

? ? ? ? String person="";

? ? ? ? String Cars="";

? ? ? ? for(int i=1;i<=b;i++){

? ? ? ? do{

? ? ? ? System.out.println("請輸入第"+i+"輛車的序號");

? ? ? ? Scanner k2=new Scanner(System.in);

? ? ? ? c=k2.nextInt();

? ? ? ? }while(c<1||c>6);

? ? ? ?

? ? ? ?

? ? ? ? car cc=cars.get(c-1);

? ? ? ? if(cc.manned>0){

? ? ? ? allmanned+=cc.manned;

? ? ? ? person+=cc.name+"";

? ? ? ? }

? ? ? ? if(cc.cargo>0){

? ? ? ? allcargo+=cc.cargo;

? ? ? ? Cars+=cc.name+""; ? ? ? ?

? ? ? ? }

? ? ? ? allrent+=cc.rent;

? ? ? ? System.out.println("請輸入要租用的天數(shù)");

? ? ? ? Scanner k3=new Scanner(System.in);

? ? ? ? int t=k3.nextInt();

? ? ? ? allrent*=t;

? ? ? ? System.out.println("你的賬單:"+"\n"+"可載人的車有:"+person+"\t"+"共載客:"+allmanned);

? ? ? ? System.out.println("可載貨的車有:"+Cars+"共載貨"+allcargo);

? ? ? ? System.out.println("總租金為:"+allrent);

? ? ? ? }

? ? ? ? ?}

? ? ? ? ?

}



}


正在回答

1 回答

有參考成分。從car cc=cars.get(c-1);開始沒有跳入if語句中。

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

舉報

0/150
提交
取消

我最后輸出的總價格什么的都是0,為什么。

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

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

幫助反饋 APP下載

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

公眾號

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