PROJECT: EYLAH


Overview

This project portfolio details my key contributions to the team software engineering project, EYLAH. The team consists of five Year 2 Computer Science undergraduates in the National University of Singapore (NUS), including myself.

We were given six weeks to either morph or enhance an existing Java project, Address Book. We chose to morph the project into EYLAH, a desktop application specifically programmed for students staying in Temasek Hall at the National University of Singapore. It aims to ease their lives at halls by providing them with an application that split bills easily and help them track their diet. The user interacts with it using a CLI and it is programmed using JAVA 11.

My role was to build the Expense Splitter portion of EYLAH and ensure that our project is on schedule for completion.

Summary of contributions

  • Major enhancement:

    1. Adding of Item, ItemPrice, ItemName for the Expense Splitter portion of EYLAH (Pull request #127)

      • What it does:
        Allows the user to perform the additem command successfully hence adding an Entry which consists of an Item into the current Receipt.

      • Justification:
        These classes are crucial for Expense Splitter to work because this allows the User to input an Item to split among his friends, the crux of Expense Splitter.

      • Highlights:
        Implementing the ItemPrice was a little tricky because Double should not be used to hold Currency as it will lead to rounding errors. Upon further research on Stack Overflow, I have decided that BigDecimal will be a better type to hold currency.

      • Credits:
        Online links where I researched on: "https://stackoverflow.com/questions/1359817/using-bigdecimal-to-work-with-currencies"

    2. Added the ability to deduct Amount owed by a Person when they have paid through paid command (Pull request #176)

      • What it does:
        Allows the user to reduce the amount owed by a Person.

      • Justification:
        This feature allows a Person to clear his/her debt. In EYLAH after a Person has cleared his/her debt, their name will be deleted to prevent cluttering of names which may confuse the user. Thus it is important to have a feature which reduces the amount of money owed by a Person.

      • Highlights:
        This enhancement helped our team discover a rather major bug with Expense Splitter workflow. In the event where the user accidentally delete an item in the receipt after his/her peers has paid the user, EYLAH will not work as intended. Fortunately, we resolved it by not allowing users to use the paid command until after a receipt has been finalised.

    3. Added the expense splitter storage component that allowed the user to automatically save a Person and their amount owed after each command (Pull request #148)

      • What it does:
        Allows EYLAH to save a Person and the amount they owe after each command.

      • Justification:
        This feature allows the user to automatically save the amount of money each person owes him after every command. This is important so the user do not have to manually input every entry again in the unlikely event where EYLAH crash.

      • Highlights:
        Ability to save a Person name and their amount owed automatically.

  • Minor enhancement:

    1. Modified the paid command to allow a Person to pay his debt fully
      (Pull request #209)

      • What it does:
        Expanded the paid command to accept empty amount field, which meant that the Person paid his debt fully.
        Previously: paid 1 3 meant that person at INDEX 1 paid $3.
        Now: paid 1 meant that person at INDEX 1 paid the full amount he owes.

      • Justification:
        This allows the user to conveniently clear a Person debt fully.

    2. Performed defensive coding for additem command and paid command
      (Pull request #352)

      • What it does:
        additem and paid commands are commands in expense splitter which includes numerical digits and multiple parameters. As a result, these commands may be exploited when discovering bugs in EYLAH. Common issues includes passing a huge numerical number which causes Integer Overflow or passing a negative index which causes ArrayOutOfBounds Exceptions. Thus I handled these rouge commands by including try-catch statement to catch these exceptions.

      • Justification:
        This reduces the chances of EYLAH crashing.

  • Code contributed:[Functional code and Test Code]

  • Other contributions:

    • Project management:

      • In charge of team progress and planning intermediate deadlines to achieve milestones.

      • Ensure that project deliverables are completed on time.

    • Enhancements to existing features:

      • Adapted the given Address Book code into EYLAH’s.

    • Documentation:

      • Updated Developer Guide to include Paid Command (Pull request #352)

      • Updated Developer Guide to include List Amount Command (Pull request #355)

      • Updated Developer Guide to include List Receipt Command (Pull request #355)

      • Updated Developer Guide to include Expense Splitter main activity diagram (Pull request #252)

      • Updated User Guide to include Paid, List Amount Command (Pull request #349)

    • Community:

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.

Listing the current receipt: listreceipt

In this section, you will learn more about the listreceipt command, how to use it and the expected outcome after using the listreceipt command.

Summary of List Receipt Command:
listreceipt shows you all the entries in your current receipt.

How to use the List Receipt Command:

Format:
listreceipt

Valid Example:
listreceipt

Expected outcome:

listreceipt
Figure 1. Expense Splitter List Receipt Command

Additional notes and tips

Each entry in the receipt has the item’s name, price and person(s) who is splitting that item with you thus you do not have to remember who you split this item with!
Use listreceipt command to find the index of the item in the receipt. The index is useful for commands such as deleteitem where you have to pass in the index of item to be deleted.

Listing amounts owed by each person: listamount

In this section, you will learn more about the listamount command, how to use it and the expected outcome after using the listamount command.

Summary of List Amount Command: listamount shows you how much each Person owes you.

How to use the List Amount Command:

Format:
listamount

Valid example:
listamount

Expected outcome:

listamount
Figure 2. Expense Splitter List Amount Command

Additional notes and tips

  • The Person and amount owed will be automatically saved after each command.

  • A person is deleted after they have completely paid the amount they owe you.

Use listamount command to find the index of the person who paid you. The index is useful for commands such as paid.

In this section, you will learn more about the paid command, how to use it and the expected outcome after using the paid command.

Summary of Paid Command: paid subtracts the amount of money a Person owes you.

How to use the Paid Command:

Format:

paid INDEX [AMOUNT]

  • INDEX is a compulsory field that must be stated by you. Instead of typing a Person’s name, you can type his/her index thus saving you time and effort. To find out his/her index, use the command listamount.

  • AMOUNT is an optional field. It refers to the amount paid by that Person. Leaving this field empty is equivalent to the Person paying you the full amount he/she owes you.

  • AMOUNT can be up to 2 decimal places, i.e. 7.99. There is no need to add the dollar sign ($).

Valid examples:

paid 2 - This commmand means that the Person at index 2 has paid you the full amount they owe you.

paid 3 3.90 - This command means that the Perosn at index 3 has paid you $3.90.

Expected outcome:

paid
Figure 3. Expense Splitter Paid Command

Additional notes and tips

  • You will only be able to use this command after you have marked the receipt as done using the donereceipt command.

  • The person will automatically be removed from the list if the amount he owes you drops to $0.

Use listamount command to find the index of the person who paid you.

For Expense Splitter

Table 1. Summary of Command for Expense Splitter
Command Format Example

Adding Item

additem -i ITEMNAME -p ITEMPRICE -n NAME [-n NAME]…​

additem -i pasta -p 5 -n John
or
additem -i pasta -p 32 -n John -n Carl -n Jasmine

Deleting Item

deleteitem INDEX

deleteitem 1
or
deleteitem 2

Listing Receipt

listreceipt

listreceipt

Listing Amount

listamount

listamount

Marking Receipt as Done

donereceipt

donereceipt

Getting Paid by Someone

paid INDEX [AMOUNT]

paid 3
or
paid 3 10.00
or
paid 2 10.0

Clearing Receipt

clearreceipt

clearreceipt

Getting Help

help

help

Going Back

back

back

Exiting the Application

exit

exit

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.

Below is the activity diagram of the entire Expense Splitter.

Activity Diagram of Expense Splitter:

ExpenseSplitterActivityDiagramV2
Figure 4. ExpenseSplitterActivityDiagram
ExpenseSplitterActivityDiagram
Figure 5. SimplifiedAddItemActivityDiagram
SimplifiedAddItemActivityDiagram is not the actual AddItem Activity Diagram. It has been simplified to provide just enough information for the user to know about the rough workflow of Expense Splitter. A more detailed diagram of Add Item can be found in AddItemCommand.

List Receipt Command

In this section, we will learn more about how the listreceipt command is implemented.

What is the List Receipt Command

The listreceipt command allows user to find out the current Items in the receipt.

The listreceipt command was implemented as a ListReceiptCommand in the expensesplitter/logic/commands package.

The listreceipt has the following input format:

listreceipt

  • Each entry in the receipt has the item’s name, price and person(s) involved in splitting that item.

  • When you enter clearrreceipt it deletes the old receipt’s data. Use it with caution!

The following activity diagram illustrates what happens when a user executes listreceipt command:

ExpenseSplitterListReceiptCommandActivityDiagram
Figure 6. List Receipt Activity Diagram

 

Structure of List Receipt Command

In this section, you will learn more about the relationships between objects related to the ListReceiptCommand.

ExpenseSplitterListReceiptCommandClassDiagram
Figure 7. List Receipt Command Class Diagram

The above class diagram shows the structure of the ListReceiptCommand and its associated classes and interfaces. Some methods and fields are left out because they are not of concern in ListReceiptCommand

Implementation of List Receipt Command

The following is a detailed explanation of the operations ListReceiptCommand performs.

  1. The ListReceiptCommand#execute(SplitterModel splitterModel) method is executed.

  2. The method SplitterModel#listReceipt() will then be called to return the list of entries currently in that Receipt.

  3. The method Receipt#toString() will use StringBuilder to build the string of the Items(s) currently in Receipt by calling Entry.toString() for entry. After all entries are done, Receipt#toString() would have finish building the string and will return to SplitterModelManager.

  4. 4. SplitterModelManager will then pass the String into CommandResult where it will be printed under the UI component.

Sequence Diagram for List Receipt Command

The following sequence diagram summarizes what happens during the execution of listreceipt command.

ExpenseSplitterListReceiptCommandSequenceDiagram
Figure 8. List Receipt Command Sequence Diagram

List Amount Command

In this section, we will learn more about how the listamount command is implemented.

What is the List Amount Command

The listamount command allows users to find out how much each Person owes them.

The listamount command was implemented as a ListAmountCommand in the expensesplitter/logic/commands package.

The listamount command has the following input format:

listamount

  • The Person and amount owed will be automatically saved after each command.

  • A person is deleted after they have completely paid the amount they owe.

The following activity diagram illustrates what happens when a user executes listamount command.

ExpenseSplitterListAmountCommandActivityDiagram
Figure 9. List Amount Activity Diagram

 

Structure of List Amount Command

In this section, you will learn more about the relationships between objects related to the ListAmountCommand.

ExpenseSplitterListAmountCommandClassDiagram
Figure 10. List Amount Command Class Diagram

The above class diagram shows the structure of the ListAmountCommand and its associated classes and interfaces. Some methods and fields are left out because they are not of concern in ListAmountCommand

Implementation of List Amount Command

The following is a detailed explanation of the operations ListAmountCommand performs.

  1. The ListAmountCommand#execute(SplitterModel splitterModel) method is executed.

  2. The method SplitterModel#listAmount() will then be called to return the list of Person(s) with their amount.

  3. PersonAmountBook#toString() will convert list of person in the list to the expected format and return it to SplitterModelManager.

  4. SplitterModelManager will then pass the String into CommandResult where it will be printed under the UI component.

Sequence Diagram for List Amount Command

The following sequence diagram summarizes what happens during the execution of listamount command.

ExpenseSplitterListAmountCommandSequenceDiagram
Figure 11. List Amount Command Sequence Diagram

In this section, we will learn more about how the paid command is implemented.

What is the Paid Command

The paid command allows user to reduce the amount of money owed by a Person after they have paid.

The paid command was implemented as a PaidCommand in the expensesplitter/logic package.

The paid command has the following input format:

paid INDEX [AMOUNT]

  • INDEX is a compulsory field. Instead of typing a Person’s name, the user can type their index. To find out his/her index, use the command listamount.

  • AMOUNT is an optional field. It refers to the amount paid by that Person. Leaving this field empty is equivalent to the Person paying the user the full amount he/she owes the user.

  • AMOUNT can be up to 2 decimal places, i.e. 7.99. There is no need to add the dollar sign ($).

The following activity diagram illustrates what happens when a user executes paid command:

ExpenseSplitterPaidCommandActivityDiagram
Figure 12. Paid Command Activity Diagram

 

Structure of Paid Command

In this section, you will learn more about the relationships between objects related to the PaidCommand.

ExpenseSplitterPaidCommandClassDiagram
Figure 13. Paid Command Class Diagram

The above class diagram shows the structure of the PaidCommand and its associated classes and interfaces. Some methods and fields are left out because they are not of concern in PaidCommand

Implementation of Paid Command

The following is a detailed explanation of the operations PaidCommand performs.

  1. The PaidCommand#execute(SplitterModel splitterModel) method is executed.

  2. The SplitterModel#paidPerson(Person person, String amountPaid) will be called. String amountPaid will be converted into an Amount by instantiating a new instance of Amount.

  3. The PersonAmountBook#removeAmount(Person person, Amount amount) is then called to remove Amount from Person.

  4. This in turns calls UniquePersonList#removeAmount(Person person, Amount amount).

  5. Lastly, Person#removeAmount(Amount amount) is called to subtract the amount from the person.

Sequence Diagram for Paid Command

The following sequence diagram summarizes what happens during the execution of paid command.

ExpenseSplitterPaidCommandSequenceDiagram
Figure 14. Paid Command Sequence Diagram
ExpenseSplitterPaidCommandSequenceDiagram2
Figure 15. Execution of Paid Command Sequence Diagram

Use case: UC10 - Listing Receipt

Actor: User
Guarantees: All Items in the current Receipt will be listed out.

MSS

  1. User requests to list receipt containing Item(s) in the current Receipt.

  2. EYLAH displays the list of Item(s) in the current Receipt, its ItemPrice and Person(s) involved in splitting that Item.

    Use case ends.

Extensions

  • 1a. EYLAH detects an empty Receipt.

    • 1a1. EYLAH displays an error message, saying that the Receipt has 0 Item.

      Use case ends.

Use case: UC11 - Listing Person(s) and the Amount they owe

Actor: User
Guarantees: All Person(s) and the amount they owe will be listed.

MSS

  1. User requests to list all the Person(s) and the Amount they owe the user.

  2. EYLAH displays the list of Person(s) and the associated Amount they owe they user.

    Use case ends.

Extensions

  • 1a. EYLAH detects an empty Person list.

    • 1a1. EYLAH displays an error message, informing user that there are no Person in the list.

      Use case ends.

Use case: UC12 - Paying money

Actor: User
Guarantees: Reduces the Amount a Person owes and if they owe $0 the Person is automatically deleted.

MSS

  1. User requests to reduce the Person’s Amount when he/she has paid the user.

  2. EYLAH searches for the Person and reduces the Amount they owe the user, if after paying the Person does not owe anything, they are deleted.

  3. EYLAH then displays the new Amount owed by the Person.

    Use case ends.

Extensions

  • 1a. EYLAH detects that the Person has paid more than what he owes.

    • 1a1. EYLAH displays an error message, informing the user to key in an Amount lesser or equal to the amount the Person owes.

      Use case ends.

  • 2a. EYLAH detects an empty PersonList.

    • 2a1. EYLAH displays an error message, saying that there is no Person in the list.

      Use case ends.

  • 2b. EYLAH detects invalid IndexOfPersonPaid.

    • 2b1. EYLAH displays an error message and informs User to key in the correct Index of the person who paid. EYLAH will prompt the user to use listamount to find the Index of Person who paid.

      Use case ends.

  • 2c. EYLAH detects that the Person does not exist in the list.

    • 2c1. EYLAH displays an error message, informing the user to key in the correct index of the Person. EYLAH will prompt the user to use listamount to find the Index of Person who paid.

      Use case ends.

List Receipt in Expense Splitter

  1. Listing the items contained in the current receipt. The order of items listed depends on the order of items added by the user.

    1. ListReceipt Command format: listreceipt

    2. Prerequisites: NIL.

    3. Test case: listreceipt
      Expected: If there are items in the receipt: List all items in the current receipt, its price and amount associated with each person involved in splitting that item

    4. Test case: listreceipt
      Expected: If there are no items in the receipt: EYLAH will inform user that there is no items currently in the receipt.

List Amount In Expense Splitter

  1. List all the Person(s) and the amount they owe.

    1. List Receipt command format: listamount

    2. Test case: listamount
      Expected: If there are Person in the list: List all Person that currently owe the User money. There should not be anyone with $0 as those who do not owe any money will be deleted from the PersonList.

    3. Test case: listamount
      Expected: If there are no Person in the list: EYLAH will inform user that there no one owes money.

  1. Reduces the amount of money a Person owes.

    1. Paid command format: paid INDEX [AMOUNT]

    2. Test case: paid 1 1.10
      Expected: Reduces the amount of money the Person at Index 1 owes by $1.10.

    3. Test case: paid 1
      Expected: Reduces the entire amount of money the Person at Index 1 owes.

    4. Test case: paid -1
      Expected: EYLAH will inform the user that INDEX is incorrect.