forked from nus-cs2113-AY2324S2/tp
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from ShyamKrishna33/add-category-functionality
Add category functionality
- Loading branch information
Showing
12 changed files
with
135 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package budgetbuddy.categories; | ||
|
||
public enum Category { | ||
DINING(1, "Dining"), | ||
GROCERIES(2, "Groceries"), | ||
UTILITIES(3, "Utilities"), | ||
TRANSPORTATION(4, "Transportation"), | ||
HEALTHCARE(5, "Healthcare"), | ||
ENTERTAINMENT(6, "Entertainment"), | ||
RENT(7, "Rent"), | ||
SALARY(8, "Salary"), | ||
OTHERS(9, "Others"); | ||
|
||
private final int categoryNum; | ||
private final String categoryName; | ||
|
||
Category(int categoryNum, String categoryName) { | ||
this.categoryNum = categoryNum; | ||
this.categoryName = categoryName; | ||
} | ||
|
||
public static Category fromNumber(int number) { | ||
for (Category category : Category.values()) { | ||
if (category.categoryNum == number) { | ||
return category; | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
public String getCategoryName() { | ||
return categoryName; | ||
} | ||
|
||
public int getCategoryNum() { | ||
return categoryNum; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.