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

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

搞了一個下午才寫出這些,求大神指點

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("序號:" + num + "\t汽車名:" + name + "\t 日租金:" + rent + "元" + "\t 可載客量:" + busload + "人"

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

}


//計算賬單

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("請輸入您要租用的天數(shù)!");

int c = input.nextInt();

System.out.println("請輸入您要租用的車輛的數(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對象

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

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

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

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

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


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

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

Scanner input = new Scanner(System.in);

int a = input.nextInt();

if (a == 1) {

//租車價目表

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

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

azda6.nature(2, "馬自達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("請關閉系統(tǒng)!!");


}

System.out.println("請輸入您要租用的汽車序號:");

int b = input.nextInt();

if (b == 1) {

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

Automobile.dowork(500);

} else if (b == 2) {

azda6.nature(2, "馬自達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 回答

可以選擇交互式對話框輸入。個人建議

0 回復 有任何疑惑可以回復我~

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

輸出結(jié)果


0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
Java入門第二季 升級版
  • 參與學習       531215    人
  • 解答問題       6327    個

課程升級!以終為始告別枯燥,在開發(fā)和重構(gòu)中體會Java面向?qū)ο缶幊痰膴W妙

進入課程

搞了一個下午才寫出這些,求大神指點

我要回答 關注問題
微信客服

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

幫助反饋 APP下載

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

公眾號

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