要求要有输入/输出交互类和对象继承控制语句排序/最值下面是一个继承范例publicclassGoodsSetting{publicstaticvoidmain(String[]args){KeyboardKeyboard[]=newKeyboard[4];Keyboard[...
要求要有输入/输出交互 类和对象 继承 控制语句 排序/最值
下面是一个继承范例
public class GoodsSetting{
public static void main(String[] args) {
Keyboard Keyboard[]=new Keyboard[4];
Keyboard[0]=new Keyboard(200,23,"黑色","type1","罗技");
System.out.println(Keyboard[0].describeDetails());
}
}
abstract class Goods { //商品类
String name; //商品名称
double price; //商品单价
int number; //商品库存
String Supplier; //商品生产厂商
public Goods(String name,double price,int number,StringSupplier){
this.name=name;
this.price=price;
this.number=number;
this.Supplier=Supplier;
}
public String describeDetails(){