最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

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

交作業(yè)啦~~


package DaDaPkg;

import java.util.Scanner;


public class Vehicle {

private String name;

private int rentingPDay;

private int PeopleCap;

private int cargoCap;

public Vehicle(String name,int rentingPDay,int peopleCap,int cargoCap){

setName(name);

setRentingPDay(rentingPDay);

setPeopleCap(peopleCap);

setCargoCap(cargoCap);

}


public String getName() {

return name;

}


public void setName(String name) {

this.name = name;

}


public int getRentingPDay() {

return rentingPDay;

}


public void setRentingPDay(int rentingPDay) {

this.rentingPDay = rentingPDay;

}


public int getPeopleCap() {

return PeopleCap;

}


public void setPeopleCap(int peopleCap) {

PeopleCap = peopleCap;

}


public int getCargoCap() {

return cargoCap;

}


public void setCargoCap(int cargoCap) {

this.cargoCap = cargoCap;

}

}

public class DaDaMain {


public static void main(String[] args) {

// TODO Auto-generated method stub

Vehicle vehicle[] = {new Vehicle("奧迪A4",500,4,0),new Vehicle("馬自達(dá)6",400,4,0),

new Vehicle("皮卡雪6",450,4,2),new Vehicle("金龍",800,20,0),

new Vehicle("松花江",400,0,4),new Vehicle("依維柯",1000,0,20)};

Scanner input = new Scanner(System.in);

int tog;

double sumCost = 0.0;

int VehicleNum = 0;

int dayOfRent = 0;

int peopleCapTotal = 0;

double cargoCapTotal = 0.0;

String nameOfVP = "";

String nameOfVC = "";

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

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

tog = input.nextInt();

if(tog == 0)return;

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

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

for(int i=0;i<=vehicle.length-1;i++){

System.out.print((i+1)+" ? ? ?");

System.out.print(vehicle[i].getName());

System.out.print(" ? ? ? ? ?");

System.out.print(vehicle[i].getRentingPDay()+"元/天 ? ?");

if(vehicle[i].getPeopleCap() != 0){

System.out.print("載人:"+vehicle[i].getPeopleCap()+"人");

}

if(vehicle[i].getCargoCap() != 0){

System.out.print("載貨:"+vehicle[i].getCargoCap()+"噸");

}

System.out.println();

}

System.out.println();

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

VehicleNum = input.nextInt();

for(int i=1;i<=VehicleNum;i++){

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

int j = input.nextInt()-1;

sumCost = sumCost + vehicle[j].getRentingPDay();

if( vehicle[j].getPeopleCap()!=0 ){

nameOfVP = nameOfVP + vehicle[j].getName() + " ?";

peopleCapTotal += vehicle[j].getPeopleCap();

}

if( vehicle[j].getCargoCap()!=0 ){

nameOfVC = nameOfVC + vehicle[j].getName() + " ?";

cargoCapTotal += vehicle[j].getCargoCap();

}

}

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

int i = input.nextInt();

sumCost = sumCost * i;

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

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

System.out.println(nameOfVP + " ? ? 共載人:"+ peopleCapTotal + "人");

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

System.out.println(nameOfVC + " ? ? 共載貨:"+ cargoCapTotal + "噸");

System.out.println("***租車(chē)總價(jià)格:" + sumCost);

input.close();

}

}


正在回答

1 回答

大哥你父類(lèi)抽象類(lèi)是不是忘了寫(xiě)abstract了

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

qq_雙子喵_1 提問(wèn)者

我沒(méi)有用到繼承啊
2018-06-28 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

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

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

進(jìn)入課程

交作業(yè)啦~~

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

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

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