Advertisement
JoshJurban

Project 3.5

Oct 8th, 2014
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.38 KB | None | 0 0
  1. package battery;
  2.  
  3. public class Battery
  4. {
  5.        
  6.     private double capacity;
  7.        
  8.         public Battery(double batteryCapacity)
  9.         {
  10.             capacity = batteryCapacity;
  11.         }
  12.  
  13.         public void drain(double amount)
  14.         {
  15.              capacity = capacity - amount;
  16.         }
  17.        
  18.         public void charge()
  19.         {
  20.             capacity = capacity;
  21.         }
  22.        
  23.         public double getRemainingCapacity()
  24.         {
  25.             return capacity;
  26.         }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement