Overview
EYLAH is a desktop application programmed specifically for students staying in Temasek Hall at the National University
of Singapore. It aims to ease their lives in hall by providing them with an application that split bills easily and help
them keep track of their diet. The user interacts with the application using a CLI and it is programmed using Java 11
.
Summary of contributions
-
Major Enhancements
-
Added Entry and Receipt for Expense Splitter portion of EYLAH (Pull request #130)
-
What it does:
Receipt is used to store multiple Entries, and these Entries are used to store the information about a particular Item and the Persons involved in splitting the cost of that Item. -
Justification:
These classes are required to keep track of Items and the Persons involved for each of that Item.
-
-
Added AddItemCommand and enhanced the DeleteItemCommand for the Expense Splitter portion of EYLAH (Pull request #134, #163)
-
What it does:
It simply adds a new Entry into the Receipt or deletes an existing Entry from the Receipt. -
Justification:
The AddItemCommand is required for users to input new Items and the Persons involved in splitting the cost of that Item. The DeleteItemCommand is for users to remove an Item in case he/she made a mistake or simply wants to remove the Item. -
Highlights:
These commands are only allowed to be used when the Receipt has not been marked as completed as this was accomplished using a boolean flag in the Receipt class. This is because of a bug that we discovered, which will be explained in the point below.
-
-
Added a boolean flag in Receipt (Pull request #201)
-
What it does
It checks if the Receipt is marked as complete (true) or incomplete (false). -
Justification
DeleteItemCommand actually removes the Amount owed by the person from the PersonAmountBook. So does the PaidCommand. As such, if a user uses the DeleteItemCommand after using the PaidCommand, and if the Amount owed goes to negative, an exception would be thrown due to the nature of BigDecimal (BigDecimal does not accept negative values). Hence, a flag was included to prevent this from happening.
-
-
Added DoneReceiptCommand and ClearReceiptCommand for the Expense Splitter portion of EYLAH (Pull request #201, #204)
-
What it does:
DoneReceiptCommand marks the Receipt as done and ClearReceiptCommand removes all existing Entries from the Receipt. -
Justification:
DoneReceiptCommand is required to toggle the boolean flag of Receipt to be done. ClearReceiptCommand does the opposite by toggling the Receipt back as undone. -
Highlights:
These commands are required to prevent an Exception being thrown with regards to negative BigDecimal values, as explained in the point above.
-
-
Added CalculateUtil for EYLAH (Pull request #191)
-
What it does:
CalculateUtil does all the handling of calculations required in EYLAH. -
Justification:
Abstraction, to make things easier and more streamlined in our application.
-
-
-
Minor Enhancements
-
Removed case sensitivity when adding a new Person
-
What it does:
All the names inputted by the user are now made into lowercase. -
Justification
This is to facilitate quicker use of the application as users would not be required to capitalize any names. Internally, this is also to prevent duplicate Person objects with the same name (but in different case sensitivity) from being created, i.e Bob vs bob or aLiCe vs alice.
-
-
Fixed the rounding issue with regards to using BigDecimal as currency in our application
-
What it does:
Decimals with regards to currency in EYLAH is made to be 2 decimal points (d.p). -
Justification
The Amount class only accepts decimals up till 2 d.p. Users are also made to only input decimals up till 2 d.p. However, the problem comes when dividing BigDecimals, e.g 10 / 3 = 3.333333… Since we create a new Amount object called amountPerPerson, i.e new Amount("3.33333"), this would throw an Exception. As such, I made it such that any all calculations with regards to BigDecimal and Amount would be kept at a maximum of 2 d.p to prevent this Exception from being thrown. In addition, I also did the formatting of the BigDecimal to be represented as a currency. -
Credits
-
Added test cases for Entry and Receipt classes
-
Added test cases for AddItemCommand, DeleteItemCommand, DoneReceiptCommand and ClearReceiptCommand
-
Assisted in downscaling of AddressBook3 by removing Phone class
-
-
-
Code contributed:
Functional and Test code -
Other contributions:
-
Project management:
-
Lead for ExpenseSplitter portion of EYLAH.
-
Participated in planning the project timeline for EYLAH.
-
-
Enhancements to existing features:
-
Enhanced ParserUtil to be able to handle more inputted texts and output the required Objects.
-
Adapted the given Address Book 3 code into EYLAH.
-
-
Documentation:
-
Updated the Developer Guide to include AddItemCommand and DeleteItemCommand (Pull request #164, #171, #353, #409)
-
Updated the Developer Guide to include ClearReceiptCommand (Pull request #359, #409)
-
Updated the User Guide to include DoneReceiptCommand and ClearReceipt Command (Pull request #241)
-
Updated the User Guide to include Appendix H: Effort (Pull request #384)
-
Updated the User Guide with minor changes with regards to the use of English and to maintain consistency throughout the document (Pull request #411)
-
-
Community:
-
Code contributed
Please click the following link to see my code contributions dashboard. Code Report
Contributions to the User Guide
Given below are sections I contributed to the User Guide. They showcase my ability to write documentation targeting end-users. |
Adding an item: additem
In this section, you will learn more about the additem
command, how to use it
and the expected outcome after using the additem
command.
Summary of Add Item Command:
additem
allows you to add an item, it’s price and the persons involved in sharing the cost of that item.
How to use the Add Item Command:
Format:
additem -i ITEMNAME -p PRICE -n NAME
additem -i ITEMNAME -p PRICE -n NAME [-n NAME]…
Valid Example:
additem -i pizza -p 30 -n bob
additem -i pasta -p 19.90 -n alice -n bob -n charlie
Expected outcome:
|
Deleting an item: deleteitem
In this section, you will learn more about the deleteitem
command, how to use it
and the expected outcome after using the deleteitem
command.
Summary of Delete Item Command:
deleteitem
allows you to delete an item from the receipt.
How to use the Delete Item Command:
Format:
deleteitem INDEX
Valid Example:
deleteitem 3
Expected outcome:
Use listreceipt to view your item indices before deletion.
|
Clears the receipt clearreceipt
In this section, you will learn more about the clearreceipt
command, how to use it
and the expected outcome after using the clearreceipt
command.
Summary of Clear Receipt Command:
clearreceipt
allows you to remove all items from the receipt and start with a clean receipt.
How to use the Clear Receipt Command:
Format:
clearreceipt
Valid Example:
clearreceipt
Expected outcome:
|
|
Contributions to the Developer Guide
Given below are sections I contributed to the Developer Guide. They showcase my ability to write technical documentation and the technical depth of my contributions to the project. |
Add Item Command
In this section, we will learn more about how the additem
command is implemented.
What is the Add Item Command
The additem
command allows the user to add an Item into the Receipt, along with the ItemPrice of the Item and the Persons
involved in splitting the cost of that Item.
The additem
command was implemented as AddItemCommand
in the expensesplitter/logic/commands
package.
The additem
command has the following input format:
additem
-i ITEMNAME
-p ITEMPRICE
-n NAME
[-n NAME]…
|
The following activity diagram illustrates what happens when a user executes the additem
command:
Structure of Add Item Command
In this section, you will learn more about the relationships between objects related to the AddItemCommand
.
The above class diagram shows the structure of the AddItemCommand
and it’s associated classes and interfaces. Some
methods and fields have been left out because they are not of concern in the AddItemCommand
.
Implementation of Add Item Command
The following is a detailed explanation of the operations AddItemCommand
performs.
-
The
AddItemCommand#execute(SplitterModel splitterModel)
method is executed and it checks if the specified Item and list of Persons to be added are valid. If valid, a new Entry would be created with the specified Item and list of Persons. -
The
SplitterModel#addEntry(Entry entry)
method would then be called to add the Entry into the Receipt. -
For each Person in the list of Persons, the Person is first checked through the
PersonAmountBook#persons
using theSplitterModel#hasPerson(Person person)
method to check if the person already exists. -
If the person does not already exist, the method
SplitterModel#addPerson(Person person)
would be called to add the person, together with the amount, into thePersonAmountBook#persons
. -
If the Person exists, the Person would be retrieved from the
PersonAmountBook#persons
using theSplitterModel#getPerson(Person person)
method, and then the amount would be added to that person using theSplitterModel#addAmount(Person person, Amount amount)
method.
Sequence diagram for Add Item Command
The following sequence diagram summarizes what happens during the execution of additem
command.
Delete Item Command
In this section, we will learn more about how the deleteitem
command is implemented.
What is the Delete Item Command
The deleteitem
command allows users to remove the Item from the Receipt via the Index.
The deleteitem
command was implemented as DeleteItemCommand
in the expensesplitter/logic/commands
package.
The deleteitem
command has the following input format:
deleteitem
INDEX
|
The following activity diagram illustrates what happens when a user executes the deleteitem
command:
Structure of Delete Item Command
In this section, you will learn more about the relationships between objects related to the DeleteItemCommand
.
The above class diagram shows the structure of the DeleteItemCommand
and it’s associated classes and interfaces. Some
methods and fields have been left out because they are not of concern in the DeleteItemCommand
.
Implementation
The following is a detailed explanation of the operations DeleteItemCommand
performs.
-
The
DeleteItemCommand#execute(SplitterModel splitterModel)
method is executed and it validates that the specified Index to delete is within range. If valid, the Entry to be deleted will be retrieved from Receipt using its Index. -
The method
SplitterModel#getEntry(Index index)
is called to retrieve the current Entry, which subsequently retrieves the current Item using theEntry#getItem()
method and the amountPerPerson associated with it via theItem#getAmountPerPerson()
method. The list of Persons are also retrieved via theEntry#getPersonsList()
method. -
For each Person in the list of Persons, the amount is subtracted from the current amount owed by the Person.
-
The method
SplitterModel#deleteEntry(int index)
will then be called to remove the Item from the Receipt.Receipt#deleteEntry(int index)
is invoked which makes a call to its internal list to remove the specified Item.
Sequence Diagram for Delete Item Command
The following sequence diagram summarizes what happens during the execution of deleteitem
command.
Clear Receipt Command
In this section, we will learn more about how the clearreceipt
command is implemented.
What is the Clear Receipt Command
The clearreceipt
command essentially deletes all the Entries in the Receipt and allows the user to input new Entries
into a clean receipt.
The clearreceipt
command was implemented as ClearReceiptCommand
in the expensesplitter/logic/commands
package.
The clearreceipt
command has the following input format:
clearreceipt
|
The following activity diagram illustrates what happens when a user executes the clearreceipt
command:
Structure of Clear Receipt Command
In this section, you will learn more about the relationships between objects related to the ClearReceiptCommand
.
The above class diagram shows the structure of the ClearReceiptCommand
and it’s associated classes and interfaces. Some
methods and fields have been left out because they are not of concern in the ClearReceiptCommand
.
Implementation of Clear Receipt Command
The following is a detailed explanation of the operations ClearReceiptCommand
performs.
-
The
ClearReceiptCommand#execute(SplitterModel splitterModel)
method is executed. -
If the Receipt is marked as undone via the
SplitterModel#isReceiptDone()
method, theSplitterModel#deleteAllEntires()
method is called, which calls thePersonAmountBook#deleteAllEntries()
method. What does method does is that it first retrieves the ArrayList<Entry> from the Receipt via theReceipt#getReceipt()
method, then for each Entry, it gets the Item and the Amount owed my each person via theEntry#getItem()
andItem#getAmountPerPerson()
methods respectively. The Amount is then removed from each Person in the Entry via theEntry#getPersonsList()
method. After which, thesplitterModel#clearReceipt()
method will then be called. This will invoke theReceipt#clearReceipt()
method which creates a new ArrayList and assigns it to the Receipt. At the same time, the booleanReceipt#isDone
is assigned tofalse
. -
If the Receipt is marked as done, the
splitterModel#clearReceipt()
method will then be called. This will invoke theReceipt#clearReceipt()
method which creates a new ArrayList and assigns it to the Receipt. At the same time, the booleanReceipt#isDone
is assigned tofalse
.
Sequence Diagram for Clear Receipt Command
The following sequence diagram summarizes what happens during the execution of the clearreceipt
command.
Use case: UC08 - Adding an Item
Actor: User
Guarantees:
Item will be added into the Receipt.
MSS
-
User keys in the ItemName, it’s ItemPrice and Person(s) involved in the splitting of the Item.
-
EYLAH adds the Item and Persons into a Entry.
-
EYLAH adds the Entry into a Receipt.
-
EYLAH displays the Item and Person(s) involved in the splitting of the item, as well as the Amount owed per Person.
Use case ends.
Extensions
-
1a. EYLAH detects empty ItemName, ItemPrice or Person(s)
-
1a1. EYLAH displays an error message and displays an example of a correct
additem
function.Use case ends.
-
-
1b. Eylah detects invalid syntax.
-
1b1. EYLAH displays an error message and displays an example of a correct
additem
function.Use case ends.
-
Use case: UC09 - Deleting an Item
Actor: User
Preconditions: Item user wants to delete is present in the Receipt.
Guarantees:
Item will be deleted from Receipt.
MSS
-
User keys in request to delete an Item in the current Receipt via it’s Index.
-
EYLAH deletes that Item and deducts the appropriate amount associated with each Person(s) involved in splitting that Item.
-
EYLAH displays a MESSAGE_SUCCESS informing the user that Item has been successfully deleted.
Use case ends.
Extensions
-
1a. User did not input the Index of the Item. (Inserting
deleteitem
instead ofdeleteitem 1
)-
1a1. EYLAH displays an error message and displays an example of a correct
deleteitem
function.Use case ends.
-
Use case: UC13 - Clearing the Receipt when Receipt is done
Actor: User
Preconditions: Receipt is marked as done.
Guarantees:
Deletes all the Entries in the Receipt. It also marks the Receipt as undone.
MSS
-
User requests to clear the receipt after he/she decides to start a clean Receipt.
-
EYLAH removes all the Entries from the Receipt.
-
EYLAH marks the Receipt as undone.
-
EYLAH display a MESSAGE_SUCCESS informing the user that the Receipt has been successfully cleared.
Use case ends.
Use case: UC14 - Clearing the Receipt when Receipt is undone
Actor: User
Preconditions: Receipt is marked as undone.
Guarantees:
Deletes all the Entries in the Receipt. It also marks the Receipt as undone.
MSS
-
User requests to clear the receipt after he/she decides to start a clean Receipt.
-
EYLAH removes Amount owed per Person from the PersonAmountBook.
-
EYLAH removes all the Entries from the Receipt.
-
EYLAH display a MESSAGE_SUCCESS informing the user that the Receipt has been successfully cleared.
Use case ends.
Add Item In Expense Splitter
-
Adding an Item into the current Receipt.
-
Add Item Command format:
additem -i ITEMNAME -p ITEMPRICE -n PERSON [-n PERSON]…
-
Test case:
additem -i pasta -p 33.50 -n John -n Bob
Expected: Adds an item with the above details to current receipt and increase the person amount equal to dividing the price with the number of person splitting that item. -
Test case:
Invalid Syntax
Expected: No item is added to the current receipt and no change to person amount. An error message will be displayed.
-
Delete Item In Expense Splitter
-
Deleting an Item from the current Receipt.
-
Delete Item Command format:
deleteitem INDEX
-
Test case:
delete 1
Expected: Removes the item of the specified index from the receipt. -
Test case:
Invalid Syntax
Expected: No item will be deleted from the current receipt. An error message will be displayed.
-
Done Receipt In Expense Splitter
-
Marks the current receipt as done.
-
Done Receipt Command format:
donereceipt
-
Test case:
donereceipt
Expected: The receipt is marked as done. A success message will be displayed.
-
Clear Receipt In Expense Splitter
-
Clears the receipt and marks the receipt as undone.
-
Clear Receipt Command format:
clearreceipt
-
Test case:
clearreceipt
Expected: The receipt is cleared and is marked as undone. A success message will be displayed.
-