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

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

搞了一個(gè)下午才寫(xiě)出這些,求大神指點(diǎn)

import java.util.Scanner;


?class Automobile {

private String name;//汽車名字

private int rent;//汽車日租金

private int busload;//汽車載客量

private int boatload;//汽車載貨量

//租車車輛屬性

public void nature(int num, String name, int rent, int busload, int boatload) {

this.name = name;

this.rent = rent;

this.busload = busload;

this.boatload = boatload;

System.out.println("序號(hào):" + num + "\t汽車名:" + name + "\t 日租金:" + rent + "元" + "\t 可載客量:" + busload + "人"

+ "\t 可載貨量:" + boatload + "噸");

}


//計(jì)算賬單

public static void rental(int days, int rent, int num) {

int rental = days * rent * num;

System.out.println("***您的賬單***");

System.out.println("租用天數(shù):" + days + "\t租用數(shù)量:" + num + "\t 總金額:" + rental + "元");

}


//輸入租車信息

public static void dowork(int rent) {

Scanner input = new Scanner(System.in);

System.out.println("請(qǐng)輸入您要租用的天數(shù)!");

int c = input.nextInt();

System.out.println("請(qǐng)輸入您要租用的車輛的數(shù)量!");

int d = input.nextInt();

rental(c, rent, d);

}


}




public class RentCat {

public static void main(String[] args) {

Automobile audiA4 = new Automobile();//創(chuàng)建奧迪A4對(duì)象

Automobile azda6 = new Automobile();//創(chuàng)建馬自達(dá)6對(duì)象

Automobile pick_up = new Automobile();//創(chuàng)建皮卡雪6對(duì)象

Automobile jinlong = new Automobile();//創(chuàng)建金龍對(duì)象

Automobile songhua = new Automobile();//創(chuàng)建松花江對(duì)象

Automobile iveco = new Automobile();//創(chuàng)建依維柯對(duì)象


System.out.println("歡迎來(lái)到噠噠租車系統(tǒng)!!");

System.out.println("您是否要租車,是按1,否按0");

Scanner input = new Scanner(System.in);

int a = input.nextInt();

if (a == 1) {

//租車價(jià)目表

System.out.println("您可租車的類型和價(jià)目表:");

audiA4.nature(1, "奧迪A4", 500, 4, 0);

azda6.nature(2, "馬自達(dá)6", 400, 4, 0);

pick_up.nature(3, "皮卡雪6", 450, 4, 2);

jinlong.nature(4, "金龍 ? ", 800, 20, 0);

songhua.nature(5, "松花江", 400, 0, 4);

iveco.nature(6, "依維柯", 1000, 0, 20);

} else {

System.out.println("請(qǐng)關(guān)閉系統(tǒng)!!");


}

System.out.println("請(qǐng)輸入您要租用的汽車序號(hào):");

int b = input.nextInt();

if (b == 1) {

audiA4.nature(1, "奧迪A4", 500, 4, 0);

Automobile.dowork(500);

} else if (b == 2) {

azda6.nature(2, "馬自達(dá)6", 400, 4, 0);

Automobile.dowork(400);

} else if (b == 3) {

pick_up.nature(3, "皮卡雪6", 450, 4, 2);

Automobile.dowork(450);

} else if (b == 4) {

jinlong.nature(4, "金龍 ? ? ? ", 800, 20, 0);

Automobile.dowork(800);

} else if (b == 5) {

songhua.nature(5, "松花江", 400, 0, 4);

Automobile.dowork(400);

} else if (b == 6) {

iveco.nature(6, "依維柯", 1000, 0, 20);

Automobile.dowork(1000);

} else {

System.out.println("您的輸入有誤!!");

}


}

}


正在回答

2 回答

可以選擇交互式對(duì)話框輸入。個(gè)人建議

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

http://img1.sycdn.imooc.com//598acb290001193206250427.jpg

輸出結(jié)果


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

舉報(bào)

0/150
提交
取消

搞了一個(gè)下午才寫(xiě)出這些,求大神指點(diǎn)

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