zoukankan      html  css  js  c++  java
  • 作业3

    class Book1{
    private String name;
    private int id;
    private float price;
    private static int num=3;
    private static int count=0;
    public Book1(){
    count++;
    this.id=count;
    }
    public Book1(int id){
    this.id=id;
    }
    public int getId(){
    return this.id;
    }
    public Book1(String name,float price){
    this.name=name;
    this.price=price;
    this.num=num;
    }
    public void setName(String name){
    this.name=name;
    }
    public String getName(){
    return this.name;
    }
    public void setPrice(float price){
    this.price=price;
    }
    public float getPrice(){
    return this.price;
    }
    public void setNum(int num){
    this.num=num;
    }
    public int getNum(){
    return this.num;
    }
    }
    public class sjx06 {

    /**
    * @param args
    */
    public static void main(String[] args) {
    // TODO Auto-generated method stub
    Book1 book[]=new Book1[6];
    book[0]=new Book1("java教程 ",99.9f);
    book[1]=new Book1("java web 教程 ",69.9f);
    book[2]=new Book1("java EE 教程 ",67.9f);
    book[3]=new Book1("android 教程 ",56.8f);
    book[4]=new Book1("Mysql 教程 ",56.5f);
    book[5]=new Book1("oracle 教程 ",78.7f);
    for(int i=0;i<book.length;i++){
    System.out.println("编号:"+new Book1().getId()
    +" 书名:"+book[i].getName()
    +" 价格:"+book[i].getPrice()
    +" 数量:"+book[i].getNum());
    }
    System.out.println("图书总量为:"+(new Book1().getId()-1)*book[1].getNum());
    }
    }

  • 相关阅读:
    IE8中li添加float属性,中英数字混合BUG
    jQuery ajax get与post后台交互中的奥秘
    BZOJ 4816 数字表格
    BZOJ 1598 牛跑步
    BZOJ 4077 Messenger
    相关分析 BZOJ 4821
    Crash的数字表格 BZOJ 2154 / jzptab BZOJ 2693
    回文串 BZOJ 3676
    古代猪文 BZOJ 1951
    树上的路径 BZOJ 3784
  • 原文地址:https://www.cnblogs.com/hell/p/5320229.html
Copyright © 2011-2022 走看看