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

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

初學(xué)小白.借鑒了其他前輩的方法,求大佬指正一下可以優(yōu)化的地方

//main入口

import java.util.Scanner;

public class Rukou {

? static Che c[]= {new Zairen("大眾",300,4),new Zairen("雪鐵龍",300,4),new Zairen("蝙蝠車(chē)",90000,1),new Zairen("高達(dá)",8000000,2),

? ? new Zaihuo("小型卡車(chē)",3000,60),new Zaihuo("中型卡車(chē)",5000,100),new Zaihuo("重型卡車(chē)",9000,300),?

? ? new Zairh("皮卡",400,4,0.5),new Zairh("輪船",600000,200,1000),new Zairh("飛機(jī)",700000,300,6000),new Zairh("火車(chē)",800000,6000,80000)

? ? };

public static void main(String[] args) {

// TODO Auto-generated method stub

Scanner in=new Scanner(System.in);

? ? System.out.println("歡迎登陸租車(chē)程序"+"\n"+"確定租車(chē)(1)還是不足租車(chē)(2)");

? ? int k=in.nextInt();?

? ? if(k==1) {

? ? System.out.println("以下為租車(chē)列表");

? ? System.out.println("序號(hào)"+"\t"+"車(chē)名"+"\t"+"租金"+"\t"+"\t"+"作用");

? ? for (int i=0,q=1;i<=c.length-1;++i,++q) {

? ? System.out.println(q+c[i].sd()+c[i].toString());

? ? }

? ? System.out.println("請(qǐng)問(wèn)你要租幾輛車(chē)");

int qa=in.nextInt();

int b=0;

? ? int zx[]=new int[qa];

while(b<qa) {

try {

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

zx[b]=in.nextInt();

++b;

}catch(Exception e) {

System.out.println("輸入錯(cuò)誤請(qǐng)重新輸入");

}

}

int zc[]=new int[zx.length];

int h=0;

int j=1;

for(int g:zx) {

System.out.println("第"+j+"輛車(chē):"+c[g-1].getK()+"需要租幾天");

zc[h]=in.nextInt();

++h;

++j;

}

System.out.println("------"+"以下是您的賬單"+"------");

System.out.println("序號(hào)"+"\t"+"車(chē)名"+"\t"+"已租天數(shù)"+"\t"+"單價(jià)/1天"+"\t"+"\t"+"總金額"+"\t"+"作用");

double y=0;

? ? for(int g=0;g<zx.length;++g) {

System.out.println((g+1)+"\t"+c[(zx[g]-1)].getK()+"\t"+zc[g]+"天"+"\t"+c[(zx[g]-1)].getJg()+"/1天"+"\t"+"\t"+(c[(zx[g])-1].getJg()*zc[g])+c[(zx[g]-1)].toString());

? ? ? ?y=y+(c[(zx[g]-1)].getJg()*zc[g]);

? ? }

? ?System.out.println("\t"+("\t")+"\t"+"\t"+"\t"+"\t"+"需付款總計(jì):"+y+"元");

? ? }else if(k==2||k>2){?

? ? System.out.println("不租車(chē)你點(diǎn)個(gè)雞兒");

? ? }

}

}

//父 類(lèi)


public abstract class Che {

private String k;

private int sl;

private double zl;

public int getSl() {

return sl;

}


public double getZl() {

return zl;

}


public void setSl(int sl) {

this.sl = sl;

}


public void setZl(double zl) {

this.zl = zl;

}


public String getK() {

return k;

}


public int getJg() {

return jg;

}


private int jg;

public Che(String k,int jg) {

this.k=k;

this.jg=jg;

}

/*

public String hzh() {

return? k+kg+ jg+"/1天" + kg +"載貨:"+zl+"噸"? ?;

}

public void seth(String k,int jg,double zl) {

this.k = k;

this.jg=jg;

this.zl=zl;

}

public String getK() {

return? k+kg+ jg+"/1天" + kg +"載人:"+sl+"人" ;

}

public void setr(String k,int jg,int sl) {

this.k = k;

this.jg=jg;

this.sl=sl;

}

*/

public void setK(String k) {

this.k = k;

}


public String sd() {

return "\t"+k+"\t"+ jg+"/1天" ;

}


public abstract String toString();


public void setJg(int jg) {

this.jg = jg;

}

}

//子類(lèi)Zaihuo

public class Zaihuo extends Che implements Zaizhong{

private double zl;

Zaihuo(String k,int jg,double zl){

? ? super(k,jg);

? ? this.zl=zl;

? ? }

@Override

public String toString() {

return? "\t" +"載貨:"+zl+"噸"? ;

}


@Override

public void zl(double zl) {

// TODO Auto-generated method stub

this.zl=zl;

}


@Override

public double zhfh() {

// TODO Auto-generated method stub

return? zl? ;

}

}

//子類(lèi)Zairen


public class Zairen extends Che implements JIekou {

private int sl;


Zairen(String k,int jg,int sl){

? ? super(k,jg);

? ? this.sl=sl;

? ?

? ? }


@Override

public String toString() {

return? "\t"+"載人:"+sl+"人" ;

}


@Override

public void sl(int sl) {

// TODO Auto-generated method stub

this.sl=sl;

}


@Override

public int zrfh() {

// TODO Auto-generated method stub

return sl;

}

?

}

//子類(lèi)Zairh


public class Zairh extends Che implements JIekou,Zaizhong{

private int sl;

private double zl;

Zairh(String k,int jg,int sl,double zl){

? ? super(k,jg);

? ? this.sl=sl;

? ? this.zl=zl;

? ? }


@Override

public String toString() {

return? "\t"+"載人:"+sl+"人" +"載重:"+zl+"噸";

}

@Override

public void zl(double zl) {

// TODO Auto-generated method stub

this.zl=zl;

}


@Override

public double zhfh() {

// TODO Auto-generated method stub

return zl;

}


@Override

public void sl(int sl) {

// TODO Auto-generated method stub

this.sl=sl;

}


@Override

public int zrfh() {

// TODO Auto-generated method stub

return sl;

}

}

//接口 JIekou

public interface JIekou {

void sl(int sl);

? ? int zrfh();

}

//接口Zaizhong

public interface Zaizhong {

public void zl(double zl);

? public? double zhfh();

}


正在回答

1 回答

膜拜大神

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

舉報(bào)

0/150
提交
取消

初學(xué)小白.借鑒了其他前輩的方法,求大佬指正一下可以優(yōu)化的地方

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