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

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

還望老師在思想面不吝賜教

雖然說(shuō)java是面向?qū)ο蟮模拔沂菍W(xué)過(guò)C的,總擺脫不了C的思維,這一次老師給的項(xiàng)目練習(xí)我就這么淡定的用C的思想硬生生的用java敲出來(lái)了,請(qǐng)問(wèn)我是不是中毒太深了,而且我也不覺(jué)的這有什么不好的,下面是我的代碼,請(qǐng)老師過(guò)目:

package com.imooc;


import java.util.Scanner;


public class Dadazhuchesystem {


public static void main(String[] args) {

// TODO Auto-generated method stub

System.out.println("歡迎使用嗒嗒租車系統(tǒng): ");

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

Scanner input = new Scanner(System.in);

int i = input.nextInt();

if(i == 1) {

System.out.println("您可租車的類型及其價(jià)格表");

System.out.println("序號(hào) 汽車名稱 租金 容量");

System.out.println("1 奧迪A4 500/天 載人:4");

System.out.println("2 馬自達(dá)6 400/天 載人:4");

System.out.println("3 皮卡雪6 450/天 載人:4;載物:2t");

System.out.println("4 金龍 800/天 載人:20");

System.out.println("5 松花江 400/天 載貨4t");

System.out.println("6 依維柯 1000/天 載貨20t");

System.out.print("請(qǐng)輸入您需要租車的數(shù)量:");

System.out.println();

} else {System.out.println("感謝您的光臨!");}

Scanner input2 = new Scanner(System.in);

int i2 = input.nextInt();

int count1 = 0, count2 = 0, count3 = 0, count4 = 0, count5 = 0, count6 = 0, countPerson = 0, countThing = 0, countMoney = 0;

for(int m = 1; m <= i2; m++) {

System.out.println("請(qǐng)輸入第" + m + "輛車的序號(hào): ");

Scanner input3 = new Scanner(System.in);

int i3 = input.nextInt();

if(i3 == 1) {

count1++; countPerson += 4; countMoney += 500;

} else if(i3 == 2) {

count2++; countPerson += 4; countMoney += 400;

} else if(i3 == 3) {

count3++; countPerson += 4; countThing += 2; countMoney += 450;

} else if(i3 == 4) {

count4++; countPerson += 20; countMoney += 800;

} else if(i3 == 5) {

count5++; countThing += 4; countMoney += 400;

} else if(i3 == 6) {

count6++; countThing += 20; countMoney += 1000;

}

}

System.out.println("請(qǐng)輸入租車的天數(shù): ");

Scanner input4 = new Scanner(System.in);

int i4 = input.nextInt();

countMoney = i4 * countMoney;

System.out.println("***可載人的車有:");

if(count1 != 0) {System.out.print("奧迪A4 ");}

if(count2 != 0) {System.out.print("馬自達(dá)6 ");}

if(count3 != 0) {System.out.print("皮卡雪6 ");}

if(count4 != 0) {System.out.print("金龍 ");}

System.out.println("可載人數(shù): " + countPerson + ";");

System.out.println("***可載貨的車有:");

if(count3 != 0) {System.out.print("皮卡雪6 ");}

if(count5 != 0) {System.out.print("松花江 ");}

if(count6 != 0) {System.out.print("依維柯 ");}

System.out.println("可載貨重量: " + countThing + "t");

System.out.println("***租車總價(jià)格: " + countMoney + "元");

}


}


正在回答

1 回答

雖然代碼思路是對(duì)的 ?但你這完全是面向過(guò)程 ?java的面對(duì)對(duì)象特性沒(méi)有任何體現(xiàn),除了Scanner之外 全部都是流程控制if else 加上個(gè)輸出語(yǔ)句。。。實(shí)在是浪費(fèi)了java的好處。

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

舉報(bào)

0/150
提交
取消

還望老師在思想面不吝賜教

我要回答 關(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)