Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.61 KB | None | 0 0
  1. public int countNumberOfCars() {
  2.         int countCars = 0;
  3.         for (int i = 0; i < shortParkingSpace.length; i++) {
  4.             if (shortParkingSpace[i].getIcon() == carImg) {
  5.  
  6.                 countCars++;
  7.  
  8.             }
  9.         }
  10.         r.setNumberOfCars(countCars);
  11.         return countCars;
  12.     }
  13.  
  14.     public double addRevenue() {
  15.         double revenue = r.getNumberOfCars() * r.getCost();
  16.         return revenue;
  17.  
  18.     }
  19.  
  20.     public String revenueToString() {
  21.  
  22.         DecimalFormat df = new DecimalFormat("£0.00");
  23.         String s = df.format(addRevenue());
  24.        
  25.         return s;
  26.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement