Guest User

User

a guest
Sep 2nd, 2016
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.95 KB | None | 0 0
  1. package HomePlanner;
  2.  
  3. import javafx.beans.property.DoubleProperty;
  4. import javafx.beans.property.StringProperty;
  5.  
  6. import java.time.LocalDate;
  7. import java.util.ArrayList;
  8. import java.util.Date;
  9.  
  10. /**
  11.  * Created by mscib on 11.08.2016.
  12.  */
  13. public class User {
  14.     private ArrayList<Expenses> listOfExpenses = new ArrayList<>();
  15.     private DoubleProperty cash;
  16.  
  17.  
  18.     public double getCash() {
  19.         return cash.get();
  20.     }
  21.  
  22.     public DoubleProperty cashProperty() {
  23.         return cash;
  24.     }
  25.  
  26.     public void setCash(double cash) {
  27.         this.cash.set(cash);
  28.     }
  29.  
  30.     public void addExpense(String name, String category, LocalDate date, double cost){
  31.         if(name != null && category != null && date != null && (cash.getValue()-cost)>0){
  32.             Expenses exp = new Expenses(category,name,cost,date);
  33.             listOfExpenses.add(exp);
  34.         }
  35.     }
  36.  
  37.     public User(double cash){
  38.         setCash(cash);
  39.     }
  40.  
  41.  
  42. }
Add Comment
Please, Sign In to add comment