Skip to content

Commit 8d6eabe

Browse files
committed
worked on transaction and budget domain and also on repo and service folder
1 parent 83a2347 commit 8d6eabe

File tree

5 files changed

+77
-1
lines changed

5 files changed

+77
-1
lines changed

smart-finance-manager/src/app/FinanceApplication.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
package app;
2+
23
import java.util.Scanner;
34

45
public class FinanceApplication{
Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
11
package domain;
22

3+
import enums.Category;
34
import java.util.EnumMap;
45
import java.time.LocalDate;
56

67
public class Budget{
78
private final LocalDate date;
8-
private final Category category;
9+
private final EnumMap<Category,Double> budgets = new EnumMap<>(Category.class);
10+
11+
// Getter
12+
public EnumMap<Category,Double> getBudget(Category category){
13+
return this.budgets.get(category);
14+
}
15+
16+
// Setter
17+
public void setBudget(Category category,double amount){
18+
budgets.put(category,amount);
19+
}
20+
21+
public void setDate(LocalDate date){
22+
this.date = date;
23+
}
924

1025
}

smart-finance-manager/src/domain/Transaction.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ private Transaction(Builder builder){
2323
this.category = builder.category;
2424
}
2525

26+
// ? Builder class for Setter
27+
2628
public static class Builder{
2729

2830
private final String notes;
@@ -66,4 +68,35 @@ public Transaction build(){
6668
return new Transaction(this);
6769
}
6870
}
71+
72+
// ? Getters
73+
74+
public String getId(){
75+
return this.id;
76+
}
77+
78+
public String getNotes(){
79+
return this.notes;
80+
}
81+
82+
public LocalDate getDate(){
83+
return this.date;
84+
}
85+
86+
public double getAmount(){
87+
return this.amount;
88+
}
89+
90+
public Status getStatus(){
91+
return this.status;
92+
}
93+
94+
public Category getCategory(){
95+
return this.category;
96+
}
97+
98+
public TransactionType getType(){
99+
return this.type;
100+
}
101+
69102
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package repository;
2+
3+
import java.util.ArrayList;
4+
import domain.Transaction;
5+
6+
public class TransactionRepository{
7+
8+
private final ArrayList<Transaction> transactions = new ArrayList<>();
9+
10+
public void save(Transaction t){
11+
transactions.add(t);
12+
}
13+
14+
public ArrayList<Transaction> getTransactions(){
15+
return new ArraList<>(transactions);
16+
}
17+
18+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package service;
2+
3+
import domain.Transaction;
4+
5+
public class TrnasactionService{
6+
7+
8+
9+
}

0 commit comments

Comments
 (0)