• 手机版

    扫码体验手机版

  • 微信公众号

    扫码关注公众号

国内首家协议开发

软芯音视解码保护平台

在线
客服

发布
需求

在线
聊天

天盟
APP

天盟APP下载

关注
微信

微信扫一扫访问
顶部

帖个代码,交流一下

package good.tianmg_optimise;public class AutoCar {    private String name;    private int price;    private int capacity;    private int car_no;    private int capacity_g;    public AutoCar(int no,String name,int price,int capacity){    this.car_no = no;    this.name = name;    this.price = price;    this.capacity = capacity;    }    public AutoCar(int no,String name,int price,int capacity_p,int capacity_g){       this.car_no = no;       this.name = name;       this.price = price;       this.capacity = capacity;       this.capacity_g = capacity_g;       }    public int getCar_no() {        return car_no;    }    public void setCar_no(int car_no) {        this.car_no = car_no;    }    public String getName() {        return name;    }    public void setName(String name) {        this.name = name;    }    public int getPrice() {        return price;    }    public void setPrice(int price) {        this.price = price;    }    public void setcapacity(int carry) {        this.capacity = carry;    }    public int getcapacity() {        return capacity;    }    public  int getcapacity_g(){        return capacity_g;    }}package good.tianmg_optimise;import java.util.*;import java.util.List;public class Main {    public static void main(String[] args) {        // write your code here        AutoCar audi = new AutoCar(1, "奥迪A4", 500, 4);        AutoCar mazida = new AutoCar(2, "马自达6", 400, 4);        AutoCar pika = new AutoCar(3, "皮卡雪6", 450, 4, 2);        AutoCar jinlong = new AutoCar(4, "金龙", 800, 20);        AutoCar songfajiang = new AutoCar(5, "松花江", 400, 4);        AutoCar yiweike = new AutoCar(6, "依维柯", 1000, 20);        Scanner input = new Scanner(System.in);        System.out.println("欢迎使用答答租车系统:" + "\n" + "您是否要租车:1是 0否");        int input_whethear = input.nextInt();        if (input_whethear == 1) {            System.out.println("你可租车的类型及其价目表:");            System.out.println("序号    " + "汽车名称    " + "租金          " + "容量    "+ "\n"                    +audi.getCar_no() + "." + "      " + audi.getName() + "      " + audi.getPrice() + "元/天" + "      " + "载人:" + audi.getcapacity() + "人"+ "\n"+            +mazida.getCar_no() + "." + "      " + mazida.getName() + "     " + mazida.getPrice() + "元/天" + "      " + "载人:" + mazida.getcapacity() + "人"+ "\n"            +pika.getCar_no() + "." + "      " + pika.getName() + "     " + pika.getPrice() + "元/天" + "      " + "载人:" + pika.getcapacity() + "人" + "载货:" + pika.getcapacity_g() + "吨"+ "\n"            +jinlong.getCar_no() + "." + "      " + jinlong.getName() + "        " + jinlong.getPrice() + "元/天" + "      " + "载人:" + jinlong.getcapacity() + "人"+ "\n"            +songfajiang.getCar_no() + "." + "      " + songfajiang.getName() + "      " + songfajiang.getPrice() + "元/天" + "      " + "载货:" + songfajiang.getcapacity_g() + "吨"+ "\n"            +yiweike.getCar_no() + "." + "      " + yiweike.getName() + "      " + yiweike.getPrice() + "元/天" + "     " + "载货:" + yiweike.getcapacity_g() + "吨");            System.out.println("请输入您要租汽车的数量:");            int AutoCar_number = input.nextInt();            int[] AutoCar_no = new int[AutoCar_number];            //List listCar = new ArrayList();            for(int i=0;i

免责声明:本内容仅代表回答会员见解不代表天盟观点,请谨慎对待。

版权声明:作者保留权利,不代表天盟立场。

使用道具 举报

全部参与1

太长了 懒得看

使用道具 举报

发新帖

发布任务需求已有1031166位用户正在使用天盟网服务

发布分类: *
任务预算: *
需求内容: *
手机号码: *
任务商家报价为
  • 预算价 :
  • 成交价 :
  • 完工期 :
  • 质保期 :

* 最终任务项目以服务商报价、双方协商为准!