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

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

java進(jìn)階.答答打車系統(tǒng)

標(biāo)簽:
Java 測試

继承的两个抽象类里面的两个抽象方法如下:

public abstract class Capacity{
public abstract int passengerCapacity(int e[], int d);
public abstract int carryingCapacity(int s[], int b);
}

主类调用并实现功能:

import java.util.Scanner;
public class Text extends Capacity{
    @Override
    public int passengerCapacity(int e[], int d){
        int humannumber=0;
        int money=0;
        int eeeee = 0,ee = 0, eee = 0, eeee= 0;
        for(int j = 0; j<d;j++){
            if(e[j] == 1){
                eeeee = eeeee+1;
                System.out.print("奥迪A4: "+ eeeee+"辆 ");
                humannumber = humannumber+4;
                money = money+500;
            }
            else if(e[j] == 2){
                ee = ee + 1;
                System.out.print("马自达6: "+ ee +"辆 ");
                humannumber = humannumber+4;
                money = money + 400;
            }
            else if(e[j] == 3 ){
                eee = eee +1;
                System.out.print("皮卡雪6: "+ eee+ "辆 ");
                humannumber = humannumber+4;
                money = money + 450;
            }
            else if(e[j] == 4 ){
                eeee = eeee +1;
                System.out.print("金龙: "+eeee +"辆  ");
                humannumber = humannumber+20;
                money = money + 800;
            }
        }
        System.out.print("总载客量为: ");
        System.out.println(humannumber);
        return money;
    }
    @Override
    public int carryingCapacity(int e[], int d){
        int goodsquantity=0;
        int money=0;
        int o =0,oo = 0, ooo = 0;
        for(int j = 0; j<d;j++){
            if(e[j] == 3){
                o = o+1;
                System.out.print("皮卡雪6: "+ o +"辆 ");
                goodsquantity = goodsquantity + 2;
            }
            else if(e[j] == 5){
                oo = oo+1;
                System.out.print("松花江: "+ oo +"辆 ");
                goodsquantity = goodsquantity + 4;
                money = money + 400;
            }
            else if(e[j] == 6 ){
                ooo = ooo+1;
                System.out.print("依维柯: "+ ooo +"辆 ");
                goodsquantity = goodsquantity + 200;
                money = money + 450;
            }
        }
        System.out.print("总载货量为: ");
        System.out.println(goodsquantity);
        return money;
    }
public static void main(String[] args){
System.out.println("您是否需要呼叫张宸打车系统:1需要,0不需要");
Scanner a = new Scanner(System.in);
int b = a.nextInt();
if(b == 1){
System.out.println("序号 汽车名称 租金      容量");
System.out.println(" 1   奥迪A4   500元/天  载人:4人");
System.out.println(" 2   马自达6  400元/天  载人:4人");
System.out.println(" 3   皮卡雪6  450元/天  载人:4载货:2吨");
System.out.println(" 4   金龙     800元/天  载人:20人");
System.out.println(" 5   松花江   400元/天  载货:4吨");
System.out.println(" 6   依维柯   1000元/天 载货:200吨");
System.out.println("请输入您要选车辆数:");
Scanner c = new Scanner(System.in);
int d = c.nextInt();
int[] e = new int[d];
    int k = 0;
    for(int i =0 ; i<d;i++){
        k=i+1;
        System.out.println("请输入您要选择的第"+ k +"辆车的序号");
        Scanner f = new Scanner(System.in);
        e[i]= f.nextInt();
    }
    int z = 0;
    Text text = new Text();
    z = text.passengerCapacity(e,d) + text.carryingCapacity(e,d);
    System.out.println("总价钱为: " + z);
}
}
}

图片描述

點擊查看更多內(nèi)容
4人點贊

若覺得本文不錯,就分享一下吧!

評論

作者其他優(yōu)質(zhì)文章

正在加載中
感謝您的支持,我會繼續(xù)努力的~
掃碼打賞,你說多少就多少
贊賞金額會直接到老師賬戶
支付方式
打開微信掃一掃,即可進(jìn)行掃碼打賞哦
今天注冊有機(jī)會得

100積分直接送

付費專欄免費學(xué)

大額優(yōu)惠券免費領(lǐng)

立即參與 放棄機(jī)會
微信客服

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

幫助反饋 APP下載

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

公眾號

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

舉報

0/150
提交
取消