Advertisement
mmayoub

Book Class

Mar 10th, 2023 (edited)
534
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.52 KB | Source Code | 0 0
  1. public class Book {
  2.     private String title;
  3.     private double rating;
  4.  
  5.     public Book(String title, double rating) {
  6.         this.title = title;
  7.         this.rating = rating;
  8.     }
  9.  
  10.     public String getTitle() {
  11.         return title;
  12.     }
  13.  
  14.     public void setTitle(String title) {
  15.         this.title = title;
  16.     }
  17.  
  18.     public double getRating() {
  19.         return rating;
  20.     }
  21.  
  22.     public void setRating(double rating) {
  23.         this.rating = rating;
  24.     }
  25.  
  26.     @Override
  27.     public String toString() {
  28.         return "Book [title=" + title + ", rating=" + rating + "]";
  29.     }
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement