car.java

来自「AutoSale Interface」· Java 代码 · 共 41 行

JAVA
41
字号
package autosale;import java.io.*;import java.util.*;public class Car extends Vehicle implements Serializable {    private String color;    private int doors;        public int getInsurancePrice() {        if (doors <= 3) return 1000;                if (doors <= 5) return 2000;                return 3000;    }        public String getColor() {        return color;    }        public int getDoors() {        return doors;    }        public Car() {        Scanner sc = new Scanner(System.in);        System.out.println("Enter color:");        color = sc.nextLine();        System.out.println("Enter number of doors:");        doors = sc.nextInt();    }        public void print() {        super.print();        System.out.println(color);        System.out.println(doors);    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?