yanivtamari

targil adult adult

Jun 12th, 2019
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.95 KB | None | 0 0
  1. public class Adult {
  2.     private String name, work;
  3.     private int high;
  4.  
  5.     public String getName() {
  6.         return name;
  7.     }
  8.  
  9.     public void setName(String name) {
  10.         this.name = name;
  11.     }
  12.  
  13.     public String getWork() {
  14.         return work;
  15.     }
  16.  
  17.     public void setWork(String work) {
  18.         this.work = work;
  19.     }
  20.  
  21.     public int getHigh() {
  22.         return high;
  23.     }
  24.  
  25.     public void setHigh(int high) {
  26.         this.high = high;
  27.     }
  28.  
  29.     public Adult(String name, String work, int high) {
  30.         this.name = name;
  31.         this.work = work;
  32.         this.high = high;
  33.     }
  34.  
  35.     public Adult(String name, int high) {
  36.         this(name, null, high);
  37.     }
  38.  
  39.     public void show() {
  40.         System.out.printf("the persons are: ");
  41.         if (work != null)
  42.             System.out.println(name + " " + work + " " + high);
  43.         else {
  44.             System.out.println(name + " " + high);
  45.         }
  46.  
  47.     }
  48. }
Add Comment
Please, Sign In to add comment