Advertisement
Promi_38

PostOffice

Dec 7th, 2021
812
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.29 KB | None | 0 0
  1.  
  2. public class PostOffice {
  3.  
  4.     String POname = "";
  5.     String areaName = "";
  6.     String zipCode = "";
  7.     String contactNumber = "";
  8.     String officerInCharge = "";
  9.  
  10.     PostOffice(String POname, String areaName, String zipCode, String contactNumber, String officerInCharge) {
  11.         this.POname = POname;
  12.         this.areaName = areaName;
  13.         this.zipCode = zipCode;
  14.         this.contactNumber = contactNumber;
  15.         this.officerInCharge = officerInCharge;
  16.     }
  17.  
  18.     PostOffice(String POname, String areaName, String zipCode) {
  19.         this.POname = POname;
  20.         this.areaName = areaName;
  21.         this.zipCode = zipCode;
  22.     }
  23.  
  24.     void getPostOffice() {
  25.         if (contactNumber != "") {
  26.                    
  27.             System.out.println("Post Office    : " + this.POname + "\n"
  28.                 + "Area           : " + this.areaName + "\n"
  29.                 + "Zip Code       : " + this.zipCode + "\n"
  30.                 + "PO contact     : " + this.contactNumber + "\n"
  31.                 + "Off In Charge  : " + this.officerInCharge + "\n");
  32.         } else {
  33.             System.out.println("Post Office    : " + this.POname + "\n"
  34.                 + "Area           : " + this.areaName + "\n"
  35.                 + "Zip Code       : " + this.zipCode + "\n");
  36.         }
  37.  
  38.     }
  39. }
  40.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement