首页 > 试题广场 >

Given definition of Book Class

[问答题]

Given definition of Book Class as following

public class Book {
private int authorID;
private int ISBN;
private double price;
   public int getAuthorID(){return authorID;}
public void setAuthorID(int authorID){this.authorID = authorID;}
public int getISBN(){return ISBN;}
public void setISBN(int iSBN){ISBN = iSBN;}
public double getPrice() {return price;}
public void setPrice(double price){this.price = price;}
}

i) W riting a Java program: Randomly generate 5 Bo ok object data, t hen create 5 objects and put them in an array (reference type), and show a book's ISBN that the book has the highest price .

ii) How to modify given Book class so that your program is simpler.


这道题你会答吗?花几分钟告诉大家答案吧!