Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CS2113-T10-4] ExpenseTracker #10

Open
wants to merge 820 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
820 commits
Select commit Hold shift + click to select a range
c123596
Add line to resolve checkstyle error
glenda-1506 Nov 10, 2024
081e9de
Merge pull request #201 from glenda-1506/debugBug
glenda-1506 Nov 10, 2024
6001904
Refactor method of storing data to resolve corruption in data files
glenda-1506 Nov 10, 2024
5976dea
Refactor code to resovle checkstyle errors
glenda-1506 Nov 10, 2024
fa51f02
Refactor EXPECTED.TXT to resolve checkstyle errors
glenda-1506 Nov 10, 2024
da3652c
Merge pull request #202 from glenda-1506/debugBug
glenda-1506 Nov 10, 2024
9421db1
Reorganise file and categories them into different packages for bette…
glenda-1506 Nov 11, 2024
cefc4be
Merge pull request #205 from glenda-1506/codeOrganisation
glenda-1506 Nov 11, 2024
6d3e62a
Remove redundant files and lines
glenda-1506 Nov 11, 2024
a75100b
Remove redundant files and lines
glenda-1506 Nov 11, 2024
37efeff
Comment out failed junit test case to resolve checkstyle error
glenda-1506 Nov 11, 2024
cc1d973
Refactor EXPECTED.TXT and length of separator
glenda-1506 Nov 11, 2024
91fc8b1
Comment out unused library import to resolve checkstyle error
glenda-1506 Nov 11, 2024
1263bff
Merge pull request #207 from glenda-1506/codeOrganisation
glenda-1506 Nov 11, 2024
4d61303
Refactor quick start and command format notes based on the updated code
glenda-1506 Nov 11, 2024
33c3f08
Refactor typos in quick start
glenda-1506 Nov 11, 2024
172a1e8
Remove ambiguity in the features by adding details
glenda-1506 Nov 11, 2024
9c988da
Refactor file names and folder names
glenda-1506 Nov 11, 2024
ed4e99f
Remove toggle-reset feature
glenda-1506 Nov 11, 2024
c77df3f
Add view-category feature
glenda-1506 Nov 11, 2024
5a710a8
Add delete-category feature
glenda-1506 Nov 11, 2024
ffab6c4
Refactor diagrams and outputs
glenda-1506 Nov 11, 2024
98acbb2
Merge pull request #208 from glenda-1506/userGuide
glenda-1506 Nov 11, 2024
0941e16
Remove toggle-reset feature
glenda-1506 Nov 11, 2024
38559ca
Refactor code to resolve checkstyle error
glenda-1506 Nov 11, 2024
d125f86
Comment out failed junit tests to resolve checkstyle error
glenda-1506 Nov 11, 2024
a2d38ac
Comment out unused library imports to resolve checkstyle error
glenda-1506 Nov 11, 2024
3897068
Merge pull request #209 from glenda-1506/debugBug
glenda-1506 Nov 11, 2024
e68817a
Resolve bulleting error in quick start
glenda-1506 Nov 11, 2024
4ba8e20
Merge pull request #210 from glenda-1506/userGuide
glenda-1506 Nov 11, 2024
5a11505
Combine format and model folder into command folder for easier catego…
glenda-1506 Nov 11, 2024
009953a
Add Architecture Diagram
glenda-1506 Nov 11, 2024
c0eddcc
Add Overall Sequence Diagram
glenda-1506 Nov 11, 2024
6a80eca
Remove irrelevant SpendSwift information
glenda-1506 Nov 11, 2024
c07a093
Refactor user stories
glenda-1506 Nov 11, 2024
7d7dd10
Merge pull request #211 from glenda-1506/developerGuide
glenda-1506 Nov 11, 2024
aae9556
Merge branch 'master' of https://github.com/AY2425S1-CS2113-T10-4/tp
kq2003 Nov 11, 2024
29b4e67
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
d2b582f
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
8e73618
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
650651c
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
f3bc0ca
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
114ce55
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
95576af
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
7a33838
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
543439d
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
0417fc3
Refactor Overall Sequence Diagram
glenda-1506 Nov 11, 2024
0ffb365
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
e38aad4
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
bac94ea
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
a0c6437
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
600232f
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
b604b0f
updated uml diagrams for add expense, add category, view budget, and…
kq2003 Nov 11, 2024
8ac6ab0
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
c3ae658
try to main
kq2003 Nov 11, 2024
4945bf7
Merge pull request #214 from kq2003/master
kq2003 Nov 11, 2024
8b07352
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
4d4ec4b
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
052a3d7
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
0e3c5bf
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
ebf6f0c
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
c435b8c
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
92b780d
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
5f4dfd7
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
afad20c
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
3d2fa56
Merge remote-tracking branch 'upstream/master' into developerGuide
glenda-1506 Nov 11, 2024
6110a3d
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
8c45cef
Remove outdated sequence diagrams
glenda-1506 Nov 11, 2024
73d328e
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
917b531
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
71eb402
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
f0af8b2
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
fe3b56d
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
adae13a
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
768d3c6
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
665363c
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
11a671a
Merge pull request #215 from MayFairMI6/bug-resolve
MayFairMI6 Nov 11, 2024
525eb8d
Add Storage class diagram
glenda-1506 Nov 11, 2024
6e37b0c
Update UserGuide.md
MayFairMI6 Nov 11, 2024
5bb701d
Update UserGuide.md
MayFairMI6 Nov 11, 2024
995ee64
Update UserGuide.md
MayFairMI6 Nov 11, 2024
f60c579
Merge pull request #216 from MayFairMI6/bug-resolve
MayFairMI6 Nov 11, 2024
619d0b1
Refactor the visibility of methods in command package
glenda-1506 Nov 11, 2024
2faa143
Add Parser class diagram
glenda-1506 Nov 11, 2024
652bd95
Remove outdated command input and parsing class diagram
glenda-1506 Nov 11, 2024
66a4e16
Resolve merge conflicts
glenda-1506 Nov 11, 2024
9376013
Add TrackerData class diagram
glenda-1506 Nov 11, 2024
c3486ba
Comment out unused libraries to resovle checkstyle erors
glenda-1506 Nov 11, 2024
13efeb7
Refactor TrackerData class diagram and remove outdated core class dia…
glenda-1506 Nov 11, 2024
c65a7c2
Remove outdated entities class diagram
glenda-1506 Nov 11, 2024
7f15ea0
Merge pull request #213 from glenda-1506/developerGuide
glenda-1506 Nov 11, 2024
3d330cf
Update PPP with recent PRs
glenda-1506 Nov 11, 2024
cbe8355
Merge pull request #217 from glenda-1506/PPP
glenda-1506 Nov 11, 2024
61069e1
Reformat table for AboutUs
glenda-1506 Nov 11, 2024
50d1f5c
Add product intro to README
glenda-1506 Nov 11, 2024
6bf3e39
Remove unused sections in DG
glenda-1506 Nov 11, 2024
470c00b
Standardise formatting in DG
glenda-1506 Nov 11, 2024
4cab13c
Merge pull request #218 from glenda-1506/Glenda-AboutUs
glenda-1506 Nov 11, 2024
acfc426
Add heading of all commands to add sequence diagrams
glenda-1506 Nov 11, 2024
33aaf40
Updated Sequence Diagram of ViewExpense, TagExpense and DeleteExpense
AdiMangalam Nov 11, 2024
7366c11
Merge pull request #220 from AdiMangalam/master
AdiMangalam Nov 11, 2024
ddf4738
Add add-category sequence diagram
glenda-1506 Nov 11, 2024
bff654a
Refactor classes to remove repeated error message
glenda-1506 Nov 11, 2024
ef5c0ec
Updated AddCategory Sequence Diagram
AdiMangalam Nov 11, 2024
7d02aef
Merge pull request #221 from AdiMangalam/master
AdiMangalam Nov 11, 2024
364111b
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
44d011f
Add add-expense sequence diagram
glenda-1506 Nov 11, 2024
bce4ba2
Added AdiMangalam Project Portfolio Page
AdiMangalam Nov 11, 2024
84e0999
Merge pull request #224 from AdiMangalam/master
AdiMangalam Nov 11, 2024
1e0fe68
Move unused diagrams into another folder
glenda-1506 Nov 11, 2024
86a47ec
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
ac45828
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
37c1112
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
b013489
Add view-budget sequence diagram
glenda-1506 Nov 11, 2024
ee3c950
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
e43e88d
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
bfc10fb
Add help sequence diagram
glenda-1506 Nov 11, 2024
563bd9a
Resolve merge conflicts
glenda-1506 Nov 11, 2024
2e43d75
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
b48f8b8
Move unused diagrams into another folder
glenda-1506 Nov 11, 2024
2fdee8d
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
ad3a8bc
Merge branch 'master' into bug-resolve
MayFairMI6 Nov 11, 2024
d7c468e
Add view-category sequence diagram
glenda-1506 Nov 11, 2024
85d5c54
Add view-expenses sequence diagram
glenda-1506 Nov 11, 2024
b50fd17
Delete repeated diagram
glenda-1506 Nov 11, 2024
1d31723
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
6292045
Add tag-expense sequence diagram
glenda-1506 Nov 11, 2024
dec9805
Delete repeated diagram
glenda-1506 Nov 11, 2024
6772800
Move unused diagrams into another folder
glenda-1506 Nov 11, 2024
64f4069
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
49e135f
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
34f1308
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
0cdac21
Add delete-expense sequence diagram
glenda-1506 Nov 11, 2024
5ab5a3e
Move unused diagrams into another folder
glenda-1506 Nov 11, 2024
00015cc
Add delete-category sequence diagram
glenda-1506 Nov 11, 2024
8c097de
Move unused diagrams into another folder
glenda-1506 Nov 11, 2024
7c9ec65
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
1dc893f
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
f1e013b
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
a0288a7
Add set-budget sequence diagram
glenda-1506 Nov 11, 2024
1208d0a
Refactor imported libraries in junit test to resolve checkstyle errors
glenda-1506 Nov 11, 2024
466ccd0
Add implementation for all sequence diagrams
glenda-1506 Nov 11, 2024
f55c029
Merge pull request #219 from glenda-1506/developerGuide
glenda-1506 Nov 11, 2024
291f89b
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
6d28c5c
Refactor all entities to have semicolon
glenda-1506 Nov 11, 2024
6e2f350
Update BudgetManager.java
MayFairMI6 Nov 11, 2024
9c6b0ff
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
41a8f51
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
44024c6
Revert "Update SpendSwiftTest.java"
MayFairMI6 Nov 11, 2024
0db2e72
Refactor manual testing instructions
glenda-1506 Nov 11, 2024
6a9c83e
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
75a83d8
Merge pull request #226 from glenda-1506/developerGuide
glenda-1506 Nov 11, 2024
b895154
Update SpendSwiftTest.java
MayFairMI6 Nov 11, 2024
e752f90
Merge pull request #225 from MayFairMI6/bug-resolve
MayFairMI6 Nov 11, 2024
596613b
Refactor DG formatting
glenda-1506 Nov 11, 2024
8b8d835
Merge pull request #227 from glenda-1506/developerGuide
glenda-1506 Nov 11, 2024
9cb14b0
Refactor PPP based on recent PRs
glenda-1506 Nov 11, 2024
93dd25f
Refactor for correct formatting
glenda-1506 Nov 11, 2024
9b430ed
Merge pull request #228 from glenda-1506/PPP
glenda-1506 Nov 11, 2024
f95971a
Merge pull request #229 from glenda-1506/developerGuide
glenda-1506 Nov 11, 2024
993bed7
Refactor sequence diagrams for consistency
glenda-1506 Nov 11, 2024
f34af4f
Merge pull request #230 from glenda-1506/developerGuide
glenda-1506 Nov 11, 2024
a17cf5d
Add in final parameters that was missed previously
glenda-1506 Nov 11, 2024
4cfb134
Refactor return value of Parser
glenda-1506 Nov 11, 2024
cdec97b
Merge pull request #231 from glenda-1506/userGuide
glenda-1506 Nov 11, 2024
e9fd817
Refactor formatting in UG
glenda-1506 Nov 11, 2024
661e1e9
Merge pull request #232 from glenda-1506/userGuide
glenda-1506 Nov 11, 2024
f746584
Refactor formatting in UG
glenda-1506 Nov 12, 2024
2a66cd6
Merge pull request #233 from glenda-1506/userGuide
glenda-1506 Nov 12, 2024
13db710
Add page breaks to DG
glenda-1506 Nov 12, 2024
ad462c0
Merge pull request #234 from glenda-1506/developerGuide
glenda-1506 Nov 12, 2024
708f8ae
Update SpendSwiftTest.java
MayFairMI6 Nov 12, 2024
d22c8cd
Add page breaks to DG
glenda-1506 Nov 12, 2024
11e6a31
Merge pull request #235 from glenda-1506/developerGuide
glenda-1506 Nov 12, 2024
105849f
Update SpendSwiftTest.java
MayFairMI6 Nov 12, 2024
a2537eb
Update SpendSwiftTest.java
MayFairMI6 Nov 12, 2024
3bd4311
Add page breaks to DG
glenda-1506 Nov 12, 2024
ae7041b
Update SpendSwiftTest.java
MayFairMI6 Nov 12, 2024
b0ca1a0
Merge pull request #236 from glenda-1506/developerGuide
glenda-1506 Nov 12, 2024
11f5276
Add page breaks to UG
glenda-1506 Nov 12, 2024
c7b96f3
Update SpendSwiftTest.java
MayFairMI6 Nov 12, 2024
9e1b795
Merge pull request #237 from glenda-1506/userGuide
glenda-1506 Nov 12, 2024
36a9b72
Add page breaks to UG
glenda-1506 Nov 12, 2024
5082657
Merge pull request #238 from glenda-1506/userGuide
glenda-1506 Nov 12, 2024
df3fcf3
Update SpendSwiftTest.java
MayFairMI6 Nov 12, 2024
4afdd0c
Update SpendSwiftTest.java
MayFairMI6 Nov 12, 2024
5bce3f2
Update SpendSwiftTest.java
MayFairMI6 Nov 12, 2024
b0e8d8d
Merge branch 'master' into bug-resolve
MayFairMI6 Nov 12, 2024
7ec8dcc
Merge pull request #239 from MayFairMI6/bug-resolve
MayFairMI6 Nov 12, 2024
d96ff6f
Cut short Glenda's PPP
glenda-1506 Nov 12, 2024
fdc1e01
Merge pull request #240 from glenda-1506/PPP
glenda-1506 Nov 12, 2024
65b942c
Cut short Glenda's PPP
glenda-1506 Nov 12, 2024
f6f5d3c
Merge pull request #241 from glenda-1506/PPP
glenda-1506 Nov 12, 2024
956b6f7
updated PPP kai
kq2003 Nov 12, 2024
fe653d0
Update SpendSwiftTest.java
MayFairMI6 Nov 12, 2024
a2316dd
Merge pull request #242 from kq2003/master
kq2003 Nov 12, 2024
e96a940
Update SpendSwiftTest.java
MayFairMI6 Nov 12, 2024
d026cae
Update SpendSwiftTest.java
MayFairMI6 Nov 12, 2024
5ddd729
Update SpendSwiftTest.java
MayFairMI6 Nov 12, 2024
8638310
Update SpendSwiftTest.java
MayFairMI6 Nov 12, 2024
d412614
Update InputParser.java
MayFairMI6 Nov 12, 2024
fca6edf
Update SpendSwiftTest.java
MayFairMI6 Nov 12, 2024
4c15042
added javadoc comments to command classes
kq2003 Nov 12, 2024
464e99e
Merge branch 'master' of https://github.com/AY2425S1-CS2113-T10-4/tp
kq2003 Nov 12, 2024
ada38bf
Merge pull request #243 from kq2003/master
kq2003 Nov 12, 2024
ee1b9fd
Update InputParser.java
MayFairMI6 Nov 12, 2024
8e93daa
Update InputParser.java
MayFairMI6 Nov 12, 2024
02d5b9e
Merge branch 'AY2425S1-CS2113-T10-4:master' into bug-resolve
MayFairMI6 Nov 12, 2024
4ce707d
added javadoc comments for Storage classes, parser classes, and managers
kq2003 Nov 12, 2024
58df2cf
updated PPP kai
kq2003 Nov 12, 2024
307b849
fixed unused javadoc tags
kq2003 Nov 12, 2024
989070f
Merge pull request #244 from kq2003/master
kq2003 Nov 12, 2024
385ee40
updated ppp kai;
kq2003 Nov 12, 2024
004502d
Merge pull request #245 from kq2003/master
kq2003 Nov 12, 2024
5920385
Refine command format notes to prevent ambiguity
glenda-1506 Nov 12, 2024
52a6aa4
Merge pull request #246 from glenda-1506/userGuide
glenda-1506 Nov 12, 2024
9907fb4
Update InputParser.java
MayFairMI6 Nov 12, 2024
80ece1e
Update InputParser.java
MayFairMI6 Nov 12, 2024
f9d4e00
Update InputParser.java
MayFairMI6 Nov 12, 2024
3719bbf
Merge branch 'master' into bug-resolve
MayFairMI6 Nov 12, 2024
f969229
Update InputParser.java
MayFairMI6 Nov 12, 2024
6183643
Refactor User Guide grammer
glenda-1506 Nov 12, 2024
ad3a575
Update InputParser.java
MayFairMI6 Nov 12, 2024
89f2729
Merge pull request #248 from glenda-1506/userGuide
glenda-1506 Nov 12, 2024
1d7994d
added javadoc for BudgetManager and budget class
kq2003 Nov 12, 2024
84ffa8d
Merge branch 'master' of https://github.com/AY2425S1-CS2113-T10-4/tp
kq2003 Nov 12, 2024
d1a596d
Update InputParser.java
MayFairMI6 Nov 12, 2024
c878f3a
Update InputParser.java
MayFairMI6 Nov 12, 2024
292aa0c
fixed unused tag
kq2003 Nov 12, 2024
6907d1d
Merge pull request #249 from kq2003/master
kq2003 Nov 12, 2024
d421743
Update InputParser.java
MayFairMI6 Nov 12, 2024
23a7c2d
Update InputParser.java
MayFairMI6 Nov 12, 2024
fea79bc
Update InputParser.java
MayFairMI6 Nov 12, 2024
0bce696
Merge pull request #247 from MayFairMI6/bug-resolve
MayFairMI6 Nov 12, 2024
9513c44
Update SpendSwiftTest.java
MayFairMI6 Nov 12, 2024
00e464c
Update SpendSwiftTest.java
MayFairMI6 Nov 12, 2024
e02a3ca
Update ExpenseManager.java
MayFairMI6 Nov 12, 2024
3695b08
Update SpendSwiftTest.java
MayFairMI6 Nov 12, 2024
2c52b6d
Update CategoryManager.java
MayFairMI6 Nov 12, 2024
88cc525
Update SpendSwiftTest.java
MayFairMI6 Nov 12, 2024
970edf2
Update SpendSwiftTest.java
MayFairMI6 Nov 12, 2024
4a209c1
Create unused code
MayFairMI6 Nov 12, 2024
6130126
Delete MayFairMI6/unused code
MayFairMI6 Nov 12, 2024
28c502d
Merge pull request #250 from MayFairMI6/bug-resolve
MayFairMI6 Nov 12, 2024
6351d3e
Create placeholder.txt
MayFairMI6 Nov 12, 2024
6c7013f
Add files via upload
MayFairMI6 Nov 12, 2024
26dc739
Merge pull request #251 from MayFairMI6/bug-resolve
MayFairMI6 Nov 12, 2024
5cafbde
Create mayfairmi6.md
MayFairMI6 Nov 23, 2024
85dd555
Delete docs/team/AravindaPPP
MayFairMI6 Nov 23, 2024
e62cc5d
Merge pull request #252 from MayFairMI6/bug-resolve
MayFairMI6 Nov 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .gitattributes
Binary file not shown.
2 changes: 2 additions & 0 deletions BudgetManagerTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

}////
3 changes: 3 additions & 0 deletions META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: seedu.spendswift.SpendSwift

48 changes: 48 additions & 0 deletions MayFairMI6/unused code/Budget.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package seedu.spendswift.command;

import seedu.spendswift.Format;




//@@author MayFairMI6
public class Budget {
private String homeCurrency;
private Category category; // Private to prevent unauthorized access or changes
private double limit; // Private to control modifications to the budget
private TrackerData trackerData;
public Budget(Category category, double limit,String homeCurrency) {
this.category = category;
this.limit = limit;
this.trackerData = trackerData;
this.homeCurrency= homeCurrency;
}

public Category getCategory() {
return category;
}

public double getLimit() {
return limit;
}

public void setLimit(double limit) {
if (limit < 0) {
throw new IllegalArgumentException("Budget limit cannot be negative.");
}
this.limit = limit;
}

public double getRemainingLimit() {
double totalExpenses = trackerData.getExpenses().stream()
.filter(e -> e.getCategory().equals(category))
.mapToDouble(Expense::getAmount)
.sum();
return limit - totalExpenses;
}

@Override
public String toString() {
return "Budget for category '" + category + "' is " + Format.formatAmount(limit) + " " + homeCurrency;
}
}
219 changes: 219 additions & 0 deletions MayFairMI6/unused code/BudgetManager.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
package seedu.spendswift.command;

import seedu.spendswift.Format;
import seedu.spendswift.parser.InputParser;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

//@@author kq2003
public class BudgetManager {
public boolean isAutoResetEnabled;
public int lastResetMonth;
private String homeCurrency;



public BudgetManager() {
this.lastResetMonth = -1;
this.isAutoResetEnabled = false;
this.homeCurrency = homeCurrency;
}

public boolean getAutoResetStatus() {
return this.isAutoResetEnabled;
}



public void toggleAutoReset() {
isAutoResetEnabled = !isAutoResetEnabled;
System.out.println("Automatic budget reset is now " + (isAutoResetEnabled ? "ON" : "OFF") + ".");
}

//@@author AdiMangalam
/**
* Checks if it is a new month and resets budgets if auto-reset is enabled.
*
* This method uses the current month to determine if a monthly budget reset
* should occur. If auto-reset is enabled and the month has changed since the
* last reset, it triggers a reset of all budgets and updates the last reset month.
*/
public void checkAndResetBudgets(TrackerData trackerData) {

Calendar calendar = Calendar.getInstance();
int currentMonth = calendar.get(Calendar.MONTH);

if (isAutoResetEnabled && currentMonth != lastResetMonth) {
resetBudgets(trackerData);
lastResetMonth = currentMonth;
}
}

/**
* Manages the monthly budget reset process.
*
* This method is intended to be called periodically to ensure budgets are reset
* at the start of a new month if necessary. It delegates the actual reset logic
* to the checkAndResetBudgets method, which handles auto-reset checks.
*/
public void manageMonthlyReset(TrackerData trackerData) {
checkAndResetBudgets(trackerData);
}

/**
* Resets the budget limits for all categories.
*
* This method iterates over all budgets in the tracker and resets each budget's
* limit as per the current configuration. By default, it maintains the same limit
* for each budget, but the reset logic can be adjusted if needed.
*/
public void resetBudgets(TrackerData trackerData) {
Map < Category, Budget > budgets = trackerData.getBudgets();

for (Budget budget: budgets.values()) {
// Resetting the budget logic can be adjusted as needed
budget.setLimit(budget.getLimit()); // For now, just maintaining the same limit
}

trackerData.setBudgets(budgets);
System.out.println("Budgets have been reset for all categories.");
}

//@@author MayFairMI6
/**
* Sets a budget limit for a specific category.
*
* If the category already has a budget, this method updates the budget limit.
* If the category does not have a budget set, it creates a new budget for the category.
*
* This method is used to track and control spending limits for different categories.
* After setting the budget, a message is displayed to confirm the action.
*
* @param categoryName The name of the category to set the budget for
* @param limit The budget limit to be set for the category (in dollars)
*/
public static void setBudgetLimit(TrackerData trackerData, String categoryName, double limit, String homeCurrency) {

List < Category > categories = trackerData.getCategories();
Map < Category, Budget > budgets = trackerData.getBudgets();
String formattedCategoryName = Format.formatInput(categoryName.trim());

if (limit < 0) {
System.out.println("Invalid input! Please provide a positive amount!");
return;
}

Category existingCategory = null;
for (Category category: categories) {
if (category.getName().equalsIgnoreCase(formattedCategoryName)) {
existingCategory = category;
break;
}
}

if (existingCategory == null) {
System.out.println("Category '" + formattedCategoryName + "' not found. Please add the category first.");
return;
}

if (budgets.containsKey(existingCategory)) {
budgets.get(existingCategory).setLimit(limit);
System.out.println("Updated budget for category '" + existingCategory + "' to " +
Format.formatAmount(limit) + " " + homeCurrency); // Added homeCurrency to output
} else {
Budget newBudget = new Budget(existingCategory, limit,
homeCurrency); // Pass homeCurrency to constructor
budgets.put(existingCategory, newBudget);
System.out.println("Set budget for category '" + existingCategory + "' to " +
Format.formatAmount(limit) + " " + homeCurrency); // Added homeCurrency to output
}

trackerData.setBudgets(budgets); // This line remains the same
}
//@author MayFairMI6
public int getLastResetMonth() {
return lastResetMonth;
}


//@@author kq2003
public void setBudgetLimitRequest(String input, BudgetManager budgetManager, TrackerData trackerData) {
try {
InputParser parser = new InputParser();
String category = parser.parseCategory(input);
double limit = parser.parseLimit(input);
String homeCurrency = parser.parseHomeCurrency(input);

if (category == null || category.isEmpty() || limit == 0) {
System.out.println("Invalid input! Please provide category name and limit.");
return;
}

budgetManager.setBudgetLimit(trackerData, category, limit, homeCurrency);
} catch (Exception e) {
System.out.println("Error parsing the input. Please use the correct format for set-budget commands.");
}
}

//@@author MayFairMI6
public void simulateMonthChange() {
Calendar calendar = Calendar.getInstance();
lastResetMonth = (calendar.get(Calendar.MONTH) + 1) % 12; // Simulate advancing by one month
}
/**
* Displays the current budget status for each category.
*
* This method checks if each category has a budget set, calculates the total expenses for that category,
* and shows the remaining budget. If the total expenses exceed the budget limit, it displays the amount
* over budget. Categories with expenses but no budget set are also displayed.
* If no budgets are set, a message is shown indicating the absence of budgets.
*/
public void viewBudget(TrackerData trackerData) {

List < Expense > expenses = trackerData.getExpenses();
Map < Category, Budget > budgets = trackerData.getBudgets();

if (budgets.isEmpty()) {
System.out.println("No budgets set for any category.");
return;
}

// mapping total expenses for a category to each category
Map < Category, Double > totalExpensesToCategory = new HashMap < > ();
for (Expense expense: expenses) {
Category category = expense.getCategory();
if (totalExpensesToCategory.containsKey(category)) {
totalExpensesToCategory.put(category, totalExpensesToCategory.get(category) + expense.getAmount());
} else {
totalExpensesToCategory.put(category, expense.getAmount());
}
}

// Calculate remaining budget, and display as needed
for (Category category: budgets.keySet()) {
Budget budget = budgets.get(category);
double totalExpense = totalExpensesToCategory.getOrDefault(category, 0.0);
double remainingBudget = budget.getLimit() - totalExpense;

if (remainingBudget >= 0) {
System.out.println(category + ": " +
Format.formatAmount(totalExpense) + " " + homeCurrency + " spent, " +
Format.formatAmount(remainingBudget) + " " + homeCurrency + " remaining");
} else {
Double positive = Math.abs(remainingBudget);
System.out.println(category + ": " + Format.formatAmount(totalExpense) +
" " + homeCurrency + " spent, " +
"Over budget by " + Format.formatAmount(positive) + " " + homeCurrency); // Added homeCurrency code
}
}

// if no budget set for certain category
for (Category category: totalExpensesToCategory.keySet()) {
if (!budgets.containsKey(category)) {
System.out.println(category + ": No budget set");
}
}
}
}
19 changes: 19 additions & 0 deletions MayFairMI6/unused code/Category.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//@@author glenda-1506
package seedu.spendswift.command;

public class Category {
private String name;

public Category(String name) {
this.name = name;
}

public String getName() {
return name;
}

@Override
public String toString() {
return name;
}
}
52 changes: 52 additions & 0 deletions MayFairMI6/unused code/CategoryManager.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
//@@author glenda-1506
package seedu.spendswift.command;

import seedu.spendswift.Format;

import java.util.List;

public class CategoryManager {


public static void addCategory(TrackerData trackerData, String categoryName) {
//@@author MayFairMI6
if (categoryName == null || categoryName.length() <= "add category".length()) {
System.out.println("Invalid category name input!");
return;
}
//@@author glenda-1506
List<Category> categories = trackerData.getCategories();
String trimmedCategoryName = categoryName.substring("add category".length()).trim();
if (trimmedCategoryName.isEmpty()) {
System.out.println("Category name is empty!");
return;
}

String formattedCategoryName = Format.formatInput(trimmedCategoryName.trim());
for (Category category : categories) {
if (category.getName().equalsIgnoreCase(formattedCategoryName)) {
System.out.println("Category '" + formattedCategoryName + "' already exists!");
return;
}
}
Category newCategory = new Category(formattedCategoryName);
categories.add(newCategory);
trackerData.setCategories(categories);
System.out.println("Category '" + newCategory + "' added successfully.");
}

public static void viewAllCategories(TrackerData trackerData) {
List<Category> categories = trackerData.getCategories();
if (categories.isEmpty()) {
System.out.println("No categories available.");
} else {
System.out.println("Categories:");
int index = 1;
for (Category category : categories) {
System.out.println(index + ". " + category.getName());
index++;
}
}
}
}

Loading
Loading