Answer to Question #260729 in Java | JSP | JSF for M Uzair

Question #260729

1.     Exercises: Write a class Book with three data members BookId, Pages and Price. It also contains the following member function: • The get() method is used to input values • The show() method is used to display values Object Oriented Programming using JAVA Lab Manual – Page 24|193 • The set() method is used to set the values of data members using parameters • The getPrice() method is used to return the value of price 


1
Expert's answer
2021-11-03T17:30:58-0400
class Book {
  private int BookId;
  private int Pages;
  private double Price;
  public int getBookId() { return this.BookId; }
  public int getPages() { return this.Pages; }
  public double getPrice() { return this.Price; }
  public void setBookId(int BookId) { this.BookId = BookId; }
  public void setPages(int Pages) { this.Pages = Pages; }
  public void setPrice(double Price) { this.Price = Price; }
  public void show() { 
    System.out.println("BookId: " + BookId);
    System.out.println("Pages: " + Pages);
    System.out.println("Price: " + Price);
  }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS