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

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

*求告知怎么得到總載人數(shù)和總租金!?。?!

//答答租車(chē)系統(tǒng)

/*

? 定義父類(lèi)

?*/

package com.sy.interfaces.dada;


public class Car {

int id;

String name;

double price;

int peopleNum;

double capacity;

public Car() {


}

public Car(int id, String name, double price, int peopleNum, double capacity) {

super();

this.id = id;

this.name = name;

this.price = price;

this.peopleNum = peopleNum;

this.capacity = capacity;

}


public void setId(int id) {

this.id = id;

}

public int getId() {

return id;

}

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public double getPrice() {

return price;

}

public void setPrice(double price) {

this.price = price;

}

public void getInfo() {

System.out.println(id + "." + "\t" + name + "\t" + price + "元/天");

}

public int getPeopleNum() {

// TODO Auto-generated method stub

return 0;

}

public double getCapacity() {

return capacity;

}

public void setCapacity(double capacity) {

this.capacity = capacity;

}

public void setPeopleNum(int peopleNum) {

this.peopleNum = peopleNum;

}

}

/*

? 定義子類(lèi)PiKa

?*/


package com.sy.interfaces.dada;


public? class PiKa extends Car {

public PiKa(int id, String name, int price, int peopleNum, int capacity) {

super(id, name, price, peopleNum, capacity);

}

public void getInfo() {

System.out.println(id + "." + "\t" + name + "\t" + price + "元/天" + "天\t載客量:" + peopleNum + "人"

+ "載貨量:" + capacity + "噸");

}

}

/*

? 定義子類(lèi)Bus

?*/


package com.sy.interfaces.dada;


public class Bus extends Car {

public Bus(int id,String name,double price,int peopleNum) {

this.id = id;

this.name = name;

this.price = price;

this.peopleNum = peopleNum;

}

public void getInfo() {

System.out.println(id + "." + "\t" + name + "\t" + price + "元/天\t載客量:" + peopleNum + "人");

}


}

/*

? 定義子類(lèi)CaChe

?*/


package com.sy.interfaces.dada;


public class CaChe extends Car {

public CaChe(int id,String name,double price,double capacity) {

this.id = id;

this.name = name;

this.price = price;

this.capacity = capacity;

}

public void getInfo() {

System.out.println(id + "." + "\t" + name + "\t" + price + "元/天\t載貨量:" + capacity + "噸");

}

}

/*

? 測(cè)試類(lèi)

?*/

package com.sy.interfaces.dada;


import java.util.*;


import javax.xml.crypto.dsig.spec.C14NMethodParameterSpec;


public class TestDada {


public static void main(String[] args) {

Car c1 = new Bus(1,"奧迪A4",500,4);

Car c2 = new Bus(2,"馬自達(dá)6",400,4);

Car c3 = new PiKa(3,"皮卡雪6",450,4,2);

Car c4 = new Bus(4,"金龍",800,20);

Car c5 = new CaChe(5,"松花江",400,4);

Car c6 = new CaChe(6,"依維柯",1000,20);

Car[] cars = {c1,c2,c3,c4,c5,c6};

System.out.println("******歡迎使用答答租車(chē)系統(tǒng)******");

System.out.println("您是否要租車(chē):1是 0否");

Scanner input = new Scanner(System.in);

int ifRent = input.nextInt();

if(ifRent == 1) {

System.out.println("您可租車(chē)的類(lèi)型及價(jià)目表:");

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

c1.getInfo();

c2.getInfo();

c3.getInfo();

c4.getInfo();

c5.getInfo();

c6.getInfo();

}else if(ifRent == 0) {

System.out.println("*****系統(tǒng)正在退出*****");

}else {

System.out.println("請(qǐng)輸入1(是)/0(否)");

}

System.out.println("請(qǐng)輸入您要租汽車(chē)的數(shù)量:");

Scanner input2 = new Scanner(System.in);

int num = input2.nextInt();

Car[] zCar = new Car[num];

double sumPrice=0;

int sumPeople=0;

double sumCapacity=0;

for(int m = 0;m < num;m++) {

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

Scanner input3 = new Scanner(System.in);

int xuhao = input3.nextInt();

zCar[m] = cars[xuhao - 1];

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

Scanner input4 = new Scanner(System.in);

int days = input4.nextInt();

double prices = cars[xuhao - 1].getPrice() * days;

sumPrice += prices;

int peoples = cars[xuhao - 1].getPeopleNum();

sumPeople += peoples;

double capacitys = cars[xuhao - 1].getCapacity();

sumCapacity += capacitys;

}

System.out.println("》》》》您的賬單如下《《《《");

System.out.println("一共租車(chē)" + num + "輛");

System.out.println("可載" + sumPeople + "人");

System.out.println("可載" + sumCapacity + "噸");

System.out.println("您需要支付" + num + "元");

System.out.println("感謝本次使用!歡迎再次使用本公司答答租車(chē)系統(tǒng)!");

}

}




******歡迎使用答答租車(chē)系統(tǒng)******

您是否要租車(chē):1是 0否

1

您可租車(chē)的類(lèi)型及價(jià)目表:

序號(hào) 汽車(chē)名稱(chēng) 租金 容量

1. 奧迪A4 500.0元/天 載客量:4人

2. 馬自達(dá)6 400.0元/天 載客量:4人

3. 皮卡雪6 450.0元/天 載客量:4人載貨量:2.0噸

4. 金龍 800.0元/天 載客量:20人

5. 松花江 400.0元/天 載貨量:4.0噸

6. 依維柯 1000.0元/天 載貨量:20.0噸

請(qǐng)輸入您要租汽車(chē)的數(shù)量:

3

請(qǐng)輸入第1輛車(chē)的序號(hào):

1

請(qǐng)輸入租車(chē)天數(shù):

2

請(qǐng)輸入第2輛車(chē)的序號(hào):

3

請(qǐng)輸入租車(chē)天數(shù):

1

請(qǐng)輸入第3輛車(chē)的序號(hào):

5

請(qǐng)輸入租車(chē)天數(shù):

4

》》》》您的賬單如下《《《《

一共租車(chē)3輛

可載0人

可載6.0噸

您需要支付3元

感謝本次使用!歡迎再次使用本公司答答租車(chē)系統(tǒng)!


正在回答

1 回答

本人小白,剛學(xué)java一個(gè)月,求大神給出詳細(xì)解釋。。。

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

四月kkk 提問(wèn)者

是我自己智障了!??!我自己的搞懂了 但還是希望大神能給出簡(jiǎn)單的方法
2019-05-18 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消
Java入門(mén)第二季 升級(jí)版
  • 參與學(xué)習(xí)       531100    人
  • 解答問(wèn)題       6280    個(gè)

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

進(jìn)入課程

*求告知怎么得到總載人數(shù)和總租金?。。?!

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