Advertisement
Guest User

Untitled

a guest
Mar 25th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. public class VeterinaryReport {
  2. private int numberOfDogs;
  3. private int numberOfCats;
  4.  
  5. public VeterinaryReport(int numberOfDogs, int numberOfCats){
  6. this.numberOfDogs = numberOfDogs;
  7. this.numberOfCats = numberOfCats;
  8. }
  9.  
  10. public void addDogs(int additionalDogs){
  11. this.numberOfDogs += additionalDogs;
  12. }
  13.  
  14. public void addCats(int additionalCats){
  15. this.numberOfCats += additionalCats;
  16. }
  17.  
  18. public void showReport(){
  19. System.out.println(this.numberOfDogs + " dogs\n" + this.numberOfCats + " cats");
  20. }
  21.  
  22. public static void main(String[] args){
  23. VeterinaryReport vr = new VeterinaryReport(12, 13);
  24. vr.addCats(3);
  25. vr.addDogs(4);
  26. vr.showReport();
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement