Developer Guide

Trippie Logo

Table of Content

Below is a list of contents that is included in this document.

1.0 Introduction

Trippie is a command-line app to plan any of your upcoming trips. It is tailored to match the needs of student travellers. Trippie lets users plan multiple trips through timetabling and allows users to track their expenses overseas. Trippie is designed for users to enter their input quickly and efficiently.

2.0 Setting up the project in your computer

This section gives an overview on how to set up the project in your computer.

Prerequisites:

⚠️ Caution: Follow the steps in the following guide precisely. Things will not work out if you deviate in some steps.

First, fork this repo, and clone the fork into your computer.

If you plan to use IntelliJ IDEA (highly recommended):

  1. Configure the JDK: Follow the guide [se-edu/guides] IDEA: Configuring the JDK to ensure IntelliJ is configured to use JDK 11.
  2. Import the project as a Gradle project: Follow the guide [se-edu/guides] IDEA: Importing a Gradle project to import the project into IDEA. Importing a Gradle project is slightly different from importing a normal Java project.

  3. Verify the setup:
    1. Run the seedu.trippie.Trippie and try a few commands.
    2. Run the tests to ensure they all pass.

3.0 Design

This section explains the high-level design of the application. Given below is an overview of each component and a more detailed explanation of the architecture. Trippie is the main class which manages the initialization of the relevant classes and their execution.

3.1 Architecture (Felix)

UML Diagram Main

Figure 1: Overall Architecture

The Architecture Diagram given above explains the high-level design of Trippie. Shown below is a diagram of Trippie’s high-level structure.

The main class ofTrippie is called Trippie.java It is responsible for:

The rest of the App consists of three components.

The Sequence diagram below (Figure 2) shows how the program flows across the different classes when parsing or executing user commands. The example below is shown for HelpCommand. Further references are shown in Figure 2.1 and Figure 2.2

UML-Command Execution

Figure 2: Sequence Diagram during Command execution


UML-Parse and Check Command

Figure 2.1: Reference of Parse and Check Command


UML-Parse Command

Figure 2.2: Reference of Parse Command

3.2 Ui (Felix)

The UI class is in charge of the user’s input, from the readCommand or getLine methods. Other functions of the Ui is to provide shorthands of Trippie’s outputs, such as greetUser or showFarewells.

3.3 Parser (Wei Shuang)

The Parser class is implemented to parse the user’s input, and returns a Command object. The Trippie class will read in this object and call the execute method under the object.

When the Parser class is unable to successfully parse the user’s input, TrippieIllegalCommandException will be thrown. (Refer to 3.7 Exceptions)

3.4 TrippieData (Ivander)

The TrippieData class is being implemented to store all of your data during Trippie’s runtime. Below is its class diagram.

TrippieData UML Diagram

Figure 3: Class Architecture

The explanation for the above Figure 3 is as follows:

  1. TrippieData can contain many Trip objects.
  2. Each Trip consists of a PlaceList and an ExpenseList.
  3. PlaceList contains an ArrayList of Places.
  4. ExpenseList contains an ArrayList of Expense.

To get the name of a Place of index 5 in PlaceList and from Trip of index 4 in TrippieData, the program will be implemented based on the following UML diagram.

Getting_Name_Of_Place_Sequence_Diagram

Figure 4: Getting a name of a Place object.

3.5 Storage (Ivander)

The storage class is in charge of all file input and output. More importantly, in managing trip files and master file.

Important methods inside this class are:

Refer to Multiple Trips Implementation to find out more about the file structure.

3.6 Command (Wei Shuang)

The Command class is designed as the parent class for other command classes (e.g. NewTripCommand, AddExpenseCommand, ExitCommand etc). Below shows its class diagram:

Command UML Diagram

Figure 5: Commands Classes

Classes inherited from the Command class will overwrite the execute method in the parent class, which is written in correspond to the command class’ name.

3.7 Exceptions (Wei Shuang)

The TrippieException class is designed as the parent class for the other exception classes like the TrippieIllegalCommandException class. These exception classes are created to specify the exceptions faced when Trippie is running.

Below shows its class diagram:

Exception UML Diagram

Figure 6: Exception Classes

4.0 Implementation

This section elaborates on some unique details about how certain features are implemented.

4.1 Multiple Trips Structure (Ivander)

Trippie is built for travelers, those who most probably has more than a single trip in mind. Therefore, the multiple trips feature is designed so that someone can easily work and switch between many trips.

All your Trip objects are stored in a java ArrayList object called tripList inside the TrippieData object. In this TrippieData object, an attribute called currentTrip is used to point to Trip object inside the ArrayList that is currently being worked on.

Multiple trips feature is designed to minimize program startup time and minimize memory usage. These aims are achieved by:

  1. Reading only one Master File trippie.txt that will be loaded on start-up.
  2. Saving each trip in separate files.
  3. Loading only the user’s most recently edited trip on start-up. This is set as the default trip which will be set as the current trip during runtime.
  4. It is only possible to work on one Trip at a single point in time.
  5. The commands new trip and load trip will change the current trip.
  6. Current trips are automatically saved after each command execution.

The format of trippie.txt is as follows:

DEFAULT <trip_index>
<trip_index - 1>,<trip_name>,<trip_date (dd-mm-yyyy)>,<trip_max_day>
1,Amazing Bali,03-04-2021,3
2,Australia,01-01-2021,8
3,Wonderful Singapore,02-01-2021,9

Here the trip_name serves both as the Trip’s name, and the file name, hence it should not contain invalid characters for file names, i.e. <>:"/\|?*. A sample directory structure containing 3 trips is as the following:

trippie_data
    ├── Amazing Bali.txt
    ├── Australia.txt
    ├── Wonderful Singapore.txt
    └── trippie.txt

4.2 Sorting Place List (Kian En)

The way Trippie sorts its place list, regardless of the order the places are added by the user, is through bubble sort. The sorting algorithm is called every time a new place is added by the user.

When listing either places, Trippie will sort them based on both Day and Time. Hence, there is a need to use a stable sorting algorithm. Bubble sort is used for its simplicity and easy implementation. Furthermore, since this sorting algorithm is called every time a new place is added, the list will always be sorted, allowing the time complexity of the sorting algorithm to be O(n).

Likewise, when sorting expenses, Trippie will sort them based on Day.

4.3 Budget and Expenses (Shawn)

Trippie provides travellers an easy and convenient way to track expenses while constantly ensuring that the budget has not been exceeded. Below is the class diagram.

Expenses UML Diagram

Figure 7: Expenses Classes

The NewTripCommand receives currencyAbbreviation, budgetValue and ForExValue from the inputs and stores it within the current Trip object. ExpenseList array object which consists of Expense object utilized the relevant objects stored in Trip. This allows AddExpenseCommand, DeleteExpenseCommand and ListExpenseCommand to access the data and edit or list them respectively. AddExpenseCommand consist of ExpenseComparator which implements Comparator<Expense>. The ExpenseComparator sorts the variables in a blackbox by comparing two objects at a time. ListExpenseCommand further access the currencyAbbreviation and ForExValue objects to print out both local and foreign currency based on the input provided.

A sample output can be seen as follows:

Total budget: 300.00 MYR (200.00 SGD)
Expense List:
[1] Day 1: bubble tea - 8.00
[2] Day 2: hotel room - 200.00
Your current total spending is 208.00 MYR (138.67 SGD)
Your current remaining budget is 92.00 MYR (61.33 SGD)
You are still spending within your budget.
[=======---] 69.3%

4.4 Foreign Exchange Converter (Shawn)

Trippie provide travellers with a quicker alternative to convert any amount into local or foreign currency. Below is its class diagram.

Currency UML Diagram

Figure 8: Currency Classes

Similar to 4.3 Budget and Expenses, currencyAbbreviation, budgetValue and forExValue are retrievable from Trip object. Currency object composes of an enumeration CurrencyType object. This provides clarity since it consists of only LOCAL and FOREIGN constants. CalculateCurrencyCommand retrieve data and convert the input amount according to the input choice.

Here’s an example of the conversion based on the relevant data and inputs.

Processing... Please Wait.
That amount in your local currency is 13.33 SGD.

4.5 Import and Export Files (Wei Shuang)

Trippie aims to let its users save and view their files in a reader-friendly format, which is why the import and export files feature is implemented. This feature is designed for users to view their trips via a text file anywhere and anytime during their trip conveniently.

Each trip will be saved individually into their respective text files, and each file will contain the trip’s ExpenseList and PlaceList. This information is portrayed in a reader-friendly format for users to read the text files easily during their trip.

Here is an example of a saved trip in text file:

This file shows your saved trips under Trippie!

Here is your itinerary! Enjoy your trip :)
Day | Start Time | End Time | Place
1 | 1400 | 1700 | Shopping at Johor Bahru City Square
1 | 2000 | 2200 | Check-in hotel
2 | 0900 | 1200 | Dinosaurs Alive Water Theme Park
2 | 1800 | 2000 | Dinner at Cafe BLD

These are your expenses!
Day | Item | Cost
1 | Hand Bag | $60.00
2 | Tickets | $75.00
2 | Buffet Dinner | $70.00

Total budget: $1000.00

Forex Abbreviation: MYR

Forex Rate: 3.0

5.0 Appendix: Requirements

5.1 Product scope (Kian En)

The following sections display Trippie’s potential target user profile and its value proposition.

5.1.0 Target user profile

Here are 4 factors for our targeted user profile

5.1.1 Value proposition

It allows users to plan multiple trips in a one-stop platform before and during the trip. It provides user with a convenient method of tracking expenditure while not spending past their budget. Lastly, it also allows user to quickly convert any amount from local to foreign currency, vice versa.

5.2 User Stories (Kian En)

This table demonstrates a list of user stories relevant to Trippie.

Version As a … I want … So that I can …
v1.0 Student event planner A good organiser Update details of the trips conveniently
v1.0 Student who loves travelling with friends To easily plan my group trip and share it with my friends Plan our trips together by being able to seek their advice easily
v1.0 Student who is unfamiliar with complex travel planners To have a simple platform that is easy to use Efficiently plan out my itinerary
v1.0 Studious student To have my trips automatically saved Not worry about my trips getting lost if I focus on something else
v1.0 Student who likes to plan as I travel To update my trips daily use them again in the future
v1.0 Student who wants to plan trips online To take note of any links and/or online references to certain accommodations, places, or restaurants Open them later
v1.0 Student in a student exchange planning committee To note down some tourist attraction places in Singapore Bring the exchange students around during orientation
v1.0 Student who likes to keep notes on places I travel before To note down my fresh experiences while on travel trips Open and look back at it anytime
v1.0 Student who is always on-the-go To input my spending in a very quick manner Input my spending without a hassle
v2.0 Student traveling to a foreign country for the first time To record cultural differences and some other travel notes before traveling there Access them quickly in that country to avoid any misunderstandings
v2.0 Student unsure on which country to visit for exchange To plan various trips before looking at them individually Make an informed decision which country I’m most interested in for exchange
v2.0 Student who is not very good at managing expenses To be reminded when my spending are going to exceed my initial budget Reduce my spending if required
v2.0 Student who plans trip ahead of time To be able to edit whatever has been planned easily Improve my itinerary easily
v2.0 Student who is interested in many overseas opportunities To create ane edit multiple trips simultaneously Plan multiple trips ahead at a time

5.3 Non-Functional Requirements (Kian En)

Requirement Type Description
Constraint Single user product
Performance Software should not be dependent on a remote server
Performance Software should not exceed 100Mb for JAR file and 15MB per PDF file
Quality Users should prefer CLI/Typing
Technical Must have Java 11 installed
Technical No DBMS, all data to be stored locally
Technical Data stored must be in human-editable files
Technical Programme should be platform independent
Technical Programme should work without an installer

5.4 Glossary

6.0 Appendix: Instructions for Manual Testing (Shawn)

Given below are the instructions to test the app manually.

6.1 Launch and Shutdown (Felix)

  1. Initial Launch
    1. Verify that you have Java 11 or above installed in your computer by running java --version.
    2. Download the latest trippie.jar from here.
    3. Copy the file to a folder where you want to run it from.
    4. Using a command line tool, navigate to the path of trippie.jar, by entering cd path/to/file
      • If your operating system is Windows, use Command Prompt.
      • If your operating system is MacOS, use Terminal.
    5. Enter java -jar trippie.jar in your command line tool and press enter.
    6. If the setup is correct, you should see a welcome message. Then, it is now ready to go.
    7. Create your first trip by entering new trip to the command line. Then, enter your trip name, start date, exchange rate, currency, and budget.
    8. Add your first place using add. Then buy your first item with buy.
    9. Try listing your places by entering list /p and your expenses with list /e.
  2. Shutdown
    1. exit to exit Trippie.
    2. Your Trippie files will be automatically saved in ./trippie_data!

6.2 Step by Step Guide (Shawn)

Given below are the Step by Step Guide to use Trippie.

Creating a new trip

  1. Creates a new trip and sets it as the current trip.
    • Test Case: Enter the command new trip. Trippie will prompt you to enter the trip name. Try inputting an invalid file name, like A trip of 01/01.
    • Expected: Trippie will ask you to re-enter the name.
Enter your new trip's name:A trip of 01/01
New trip should not contain invalid characters like <>:"/\|?*
Enter your new trip's name:
Enter your new trip's name:test
Enter your new trip's start date (dd-mm-yyyy):01-01-2011
Enter the foreign exchange rate:3.0
Enter the foreign currency abbreviation (eg. MYR):THA
Enter your budget for the trip (in SGD):150
Added the trip 1 test 01-01-2011
Current trip is set to 'test'.

Loading an existing trip

Here are your existing trips.
1. test [No places or expenses added yet]

Which one do you want to load? Enter the index:1
Current trip is set to 'test'.
Reading the Trippie files now...

Editing an existing trip

Which one do you want to edit? Enter the index:1
Current trip is set to 'test'.
Reading the Trippie files now...
Leave the field empty if you do not want to change the specified detail.
Enter edited name, [old: test]:old
Enter your new trip's start date (dd-mm-yyyy) [old:01-01-2011]:01-01-2012
Enter the foreign exchange rate [old:3.0]:4.0
Enter the foreign currency abbreviation (eg. MYR) [old: THA]:TAH
Enter your budget for the trip (in SGD) [old:200.0]:200
Edited the trip 1 old 01-01-2012

Deleting trip

Here are your existing trips.
1. old [No places or expenses added yet]

Which one do you want to edit? Enter the index:1
Current trip is set to 'old'.
Reading the Trippie files now...
Are you sure you want to permanently delete 'old'? [Y/N]:Y
Deleted trip old.

Viewing help

Adding a place

Got it. I've added this place:
0000 - 0100 test place
Now you have 1 place in the list.

Listing all places

DAY 3: (2011-01-03)
[1] 0000 - 0100 test place

Searching places with keyword

Here is your search result:
1.0000 - 0100 test place on DAY 3

Deleting place

Noted. I've removed this place from the place list.
0000 - 0100 test place
Now you have 0 place in the list.

Editing budget

_________________________________________________________________________
Successfully set your total budget to 1000.00
_________________________________________________________________________

Adding an expense

Got it! I've added the following item: Day 2: item test - 300.00 THA
Now you have 1 item in the list.

Listing all expenses

Total budget: 600.00 THA (200.00 SGD)
Expense List:
[1] Day 2: item test - 300.00 THA
Your current total spending is 300.00 THA (100.00 SGD)
Your current remaining budget is 300.00 THA (100.00 SGD)
You are still spending within your budget.
[=====-----] 50.0%

Deleting expense

Noted. I've removed this item from the expenditure list.
Day 2: item test - 300.00 THA
Now you have 0 item in the list.

Converting currency

Processing... Please Wait.
That amount in your foreign currency is 750.00 THA.

Exiting Trippie

Bye. Hope to see you again soon!

Back to the top