Advertisement
Vladkoheca

reader.java

Nov 22nd, 2024
16
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | Source Code | 0 0
  1. public class Reader {
  2.  
  3.     public String name;
  4.     public int age;
  5.     public int booksRead;
  6.  
  7.     public Reader(String name, int age, int booksRead){
  8.         this.name = name;
  9.         this.age = age;
  10.         this.booksRead = booksRead;
  11.     }
  12.  
  13.     public int addBooks(int count){
  14.         return booksRead += count;
  15.     }
  16.  
  17.     public void displayReader(){
  18.         System.out.println("The name of the reader is : " + name);
  19.         System.out.println("The age of the reader is : " + age);
  20.         System.out.println("The books the reader have read are : " + booksRead);
  21.  
  22.  
  23.     }
  24.  
  25.  
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement