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

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

哎。這是我寫的 好吧我承認(rèn)有抄的 有幾個(gè)子類還沒復(fù)制

package dadazuche;

import java.util.Scanner;

public class Initail {

public static void main(String[] args) {

Scanner input= new Scanner(System.in);

int rentsum = 0;

int i =0;

StringBuffer ?permessage = new StringBuffer();

StringBuffer ?goodsmessage = new StringBuffer();

int zairenshu=0;

int zaihuoshu=0;

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

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

int choose = input.nextInt();

Car cars[]={new Passenger("奧迪A4",500,4),new Passenger("馬自達(dá)6",400,4),new Pika("皮卡雪6",450,4,2),new Passenger("金龍",800,20),new Goods("松花江",400,4),new Goods("依維柯",1000,20)};

if(choose==0){

System.out.println("歡迎再次光臨!");

}

if (choose == 1){

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

}

for(i=0 ;i<cars.length;i++){

System.out.print((i+1)+".\t");

if(cars[i] instanceof Passenger){

System.out.println(cars[i].name+"\t"+cars[i].rent+"元/天"+"\t"+"\t"+"載人:"+"\t"+cars[i].person+"人");}

if(cars[i] instanceof Goods){

System.out.println(cars[i].name+"\t"+cars[i].rent+"元/天 "+"\t"+"載貨:"+"\t"+cars[i].goods+"噸");}

if(cars[i] instanceof Pika){

System.out.println(cars[i].name+"\t"+cars[i].rent+"元/天"+"\t"+"\t"+"載人:"+"\t"+cars[i].person+"人"+"\t載貨:"+cars[i].goods+"噸");

}

}

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

int numberday=input.nextInt();

for (i=0;i<numberday;i++){

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

int xuhao = input.nextInt();

xuhao=xuhao-1;

if(cars[xuhao] instanceof Passenger){

rentsum+=cars[xuhao].rent;

permessage.append(cars[xuhao].name+"\t");

zairenshu+=cars[xuhao].person;

}

if(cars[xuhao] instanceof Goods){

rentsum+=cars[xuhao].rent;

goodsmessage.append(cars[xuhao].name+"\t");

zaihuoshu+=cars[xuhao].goods;

}

if(cars[xuhao] instanceof Pika){

rentsum+=cars[xuhao].rent;

permessage.append(cars[xuhao].name+"\t");

zairenshu+=cars[xuhao].person;

zaihuoshu+=cars[xuhao].goods;

}

}

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

int days=input.nextInt();

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

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

System.out.println(permessage+"可載人:"+zairenshu+"人");

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

System.out.println(goodsmessage+"可載貨:"+zaihuoshu+"噸");

System.out.println("租車的總價(jià)格:"+rentsum*days);

}

}


正在回答

5 回答

哎 ? ?都是抄的 我只是分析了一下又自己編了一遍?

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

Pika 類

package dadazuche;


public class Pika extends Car {

public Pika(String name,int rent ,int person , int goods){

this.name=name;

this.rent = rent ;

this.person=person;

this.goods=goods;

}

}


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

Passenger 類

package dadazuche;


public class Passenger extends Car {

public Passenger(String name ,int rent ,int person){

this.name=name;

this.rent=rent;

this.person=person;

}

}


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

Goods類

package dadazuche;


public class Goods extends Car {

public Goods(String name,int rent,int goods){

this.name=name;

this.rent=rent;

this.goods=goods;

}

}

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

Car 類

package dadazuche;


public class Car {

protected String name;

protected int rent;

protected int person;

protected int goods;

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public int getRent() {

return rent;

}

public void setRent(int rent) {

this.rent = rent;

}

public int getPerson() {

return person;

}

public void setPerson(int person) {

this.person = person;

}

public int getGoods() {

return goods;

}

public void setGoods(int goods) {

this.goods = goods;

}

}

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

舉報(bào)

0/150
提交
取消

哎。這是我寫的 好吧我承認(rèn)有抄的 有幾個(gè)子類還沒復(fù)制

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

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

幫助反饋 APP下載

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

公眾號(hào)

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