File tree Expand file tree Collapse file tree 5 files changed +77
-1
lines changed
smart-finance-manager/src Expand file tree Collapse file tree 5 files changed +77
-1
lines changed Original file line number Diff line number Diff line change 11package app ;
2+
23import java .util .Scanner ;
34
45public class FinanceApplication {
Original file line number Diff line number Diff line change 11package domain ;
22
3+ import enums .Category ;
34import java .util .EnumMap ;
45import java .time .LocalDate ;
56
67public 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}
Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 1+ package service ;
2+
3+ import domain .Transaction ;
4+
5+ public class TrnasactionService {
6+
7+
8+
9+ }
You can’t perform that action at this time.
0 commit comments