Advertisement
mmayoub

ServiveOffice, Customer class

Aug 24th, 2017
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.43 KB | None | 0 0
  1. package ServicePkg;
  2.  
  3. public class Customer {
  4.     // number of all Customers
  5.     private static int totalCounter = 0;
  6.     private int number;
  7.  
  8.     public Customer() {
  9.         totalCounter += 1;
  10.         this.number = totalCounter;
  11.     }
  12.  
  13.     public static int getTotalCounter() {
  14.         return Customer.totalCounter;
  15.     }
  16.  
  17.     public int getNumber() {
  18.         return this.number;
  19.     }
  20.  
  21.     @Override
  22.     public String toString() {
  23.  
  24.         return "Customer #" + this.number;
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement