10000 GitHub - RobNawrot/Java-ePortfolio: A Java-based application with a GUI for managing investment portfolios, enabling users to buy, sell, update prices, calculate gains, and search investments. Features include robust input validation, data persistence via file I/O, and efficient design using polymorphism, abstract classes, and a HashMap index for fast searches.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

A Java-based application with a GUI for managing investment portfolios, enabling users to buy, sell, update prices, calculate gains, and search investments. Features include robust input validation, data persistence via file I/O, and efficient design using polymorphism, abstract classes, and a HashMap index for fast searches.

Notifications You must be signed in to change notification settings

RobNawrot/Java-ePortfolio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

(1) General problem attempting to be solved.

The task of this assignment is to present an intuitive program to an investor seeking to maintain a portfolio of 
investment transactions involving Stocks and Mutual Funds. Furthermore, the program should be adept at performing some basic 
opertions involving these investments. The investor should be capable of buying and storing their investments into the portfolio program
in order to keep track of all their transactions; creating a singular list that holds Stock and Mutual Fund investments. In addition, the investor
should be capable of performing sell operations on currently owned investments, updating the prices of existing investments, calculating the total 
Gain across all investments and performing a filtered search for investments currently owned.

This assignment implements the concept of inheritance where now the portfolio program code is more efficient in the sense that duplicate or redundant
code is minimized and a main superclass bears the duty of initializing all relevant instance variables and methods for the subclasses involved. In addition,
this assignment implements a Graphical User Interface (GUI) that grants the user a much more visceral interaction with the ePortfolio program. This latest 
implementation provides the user with a seamless and intuitive experience when conducting investing operations that rely solely on the user's choice of actions,
and not on any particular linear order of execution. The GUI is equipped with several interfaces that can be accessed via a menu bar contained within the main
frame, each containing one of the previously developed options.


(2) Assumptions & Limitations of my solution.


Some assumptions include:

- User is an implied investor and finds user options to be intuitive.

- All input textfields are entered appropriately minimizing chance for an invalid error message to appear.

- When the user makes an investment, the user ideally would like to see proof of the transaction occurring and thus 
a confirmation summary is displayed detailing the most recent investment.

- A user may want to try another attempt at a program option and my solution attempts to give this extra attempt where 
it seems appropriate.

Some Limitations to my solution include:

- The lack of utilizing an abstract class along with abstract methods.
- The lack of utilizing an equals methods.


(3) Compile/Build and Run instructions. 


TO COMPILE THE PROGRAM:

While within the Investments (package) directory ===>  javac Investment.java MutualFund.java Stock.java Portfolio.java GUI.java ===> or simply: javac *.java


TO RUN THE PROGRAM:

While within the rnawrot_a3 directory ===> java Investments.Portfolio


(4) Correctness Testing.


Test Plan:


INHERITANCE
Testing involved making sure inheritance was being appropriately applied to the two subclasses. 

Ex. Making sure that both subclass types were capable of being stored into the singular ArrayList of the superclass type.

Ex. When outputting investments stored in the ArrayList, the overrode toString method belonging to the corresponding investment type 
would trigger on the output display.


GUI

Firstly, before adding any sort of functionality to the gui my first objective was to build out all the interfaces corresponding to each option given to 
the user. Making sure to manipulate component visibility through the use of action listener classes so that only one individual interface was shown at any 
given time chosen by the user via a menu bar. Furthermore, this involved creating a menu bar that would be continuously accessable no matter what interface was
currently being viewed. In addition, creating a menu filled with menu items registered under their corresponding listener classes were added to the menu bar. 

Each interface consisted of a main border layout manager and consisted of various arrangements of inner layout managers and components in order to best meet the
design standards given in the assignment example.

Testing involved:

- Running the program and verifying that a gui frame appears.
- Whilst running the program, verifying that the menu bar does indeed change interface visibility when choosing through the options while also maintaining accessability
to the menu bar.
- Making sure that the textareas where information is displayed to the user is read-only.
- Making sure that all textfields that require input from the user are editable and those that should be read-only are non-editable.
- Making sure that all components such as panels, labels, textfields, buttons, etc are laid out appropriately.


INITIAL INTERFACE

Testing involved:

- Making sure to center the welcoming message and instructions.
- Making sure that upon launch of the gui, the welcoming message containing instructions for the user in navigating the ePortfolio program is displayed.
- Making sure that the welcoming interface was available via menu bar should the user ever require rebriefing of instructions.


BUY INTERFACE

Testing involved:

- Making sure when a purchase is made it gets added to the ArrayList.
    Ex. After creating an investment, I tried recreating the same investment and made sure that no duplicate copy was being made.
    Ex. After creating an investment, I tried selling that same investment fully, then afterwards when attempting to sell more of that same investment, I was prompted 
    that the investment does not exist. This confirmed to me that it was in fact stored within the ArrayList and when deleted, removed from the ArrayList.
    Ex. I also made each recent transaction output the investment's details into the text area as proof to the user.

- Making sure that the user must fill all textfields with appropriate values in order to purchase an investment.
    Ex. If inputting something invalid like a number wthin an ASCII field or an ASCII character within a number field, prompting the user to retry.
    Ex. If all or multiple fields are left blank, wrote a try-catch handler to catch the exception being thrown.

- Making sure the Reset button was properly clearing all textfields.
    Ex. Entered some values within the textfields and then clicked Reset to verify.


SELL INTERFACE

Testing involved:

- Making sure that a partial/full sell was being made on an investment.
    Ex. For this, I simply made sure to output the sell operation on the affected investment into the text area. This allowed me to find that investment within the ArrayList
    and check its quantity and price values to verify the updates. If a full sell was made then my code would detect this and display a prompt to the text area saying the
    investment was fully sold and removed from the portfolio.

- Making sure that the use must fill all textfields with appropriate values in order to sell an investment.
    Ex. If inputting something invalid like a number wthin an ASCII field or an ASCII character within a number field, prompting the user to retry.
    Ex. If all or multiple fields are left blank, wrote a try-catch handler to catch the exception being thrown.

- Making sure the Reset button was properly clearing all textfields.
    Ex. Entered some values within the textfields and then clicked Reset to verify.


UPDATE INTERFACE

Testing involved:

- Making sure that the Prev and Next buttons functioned properly.
    Ex. For this, my code detected when the ArrayList reached an UPPER or LOWER bound in the ArrayList indicating an end, and disabling the corresponding end's button navigator.
    Ex. If there were multiple investments, made sure that the updating started with the first investment made in the ArrayList and wanting to update an investment further into
    the ArrayList would require using the Next navigation button until it is reached.      
    Ex. If there was only one investment in the ArrayList so far, made sure that no matter which button you press (Prev or Next) it would display the investment

- Making sure that each investment existing in the ArrayList being navigated, displays their respective Symbol and Name values so that the user knows what investment they are 
currently viewing at any given time while passing through.
    Ex. Checked to see that the read-only textfields were being updated to new values belonging to each investment being navigated through in the ArrayList.

- Making sure that the user entered a number value for the Price field.
    Ex. If the price field was left blank or an ASCII value was used, I wrote a try-catch handler to catch the exception being thrown and prompted the user to try again.


TOTAL GAIN INTERFACE

Testing involved:

- Making sure that the user must make an investment in order to make full use of the total gain interface.
    Ex. If no investment has been made upon reaching the Total Gain interface, then the user gets prompted to purchase at least one investment before the total gain can be displayed.

- Making sure that the individual/total gain is being calculated.
    Ex. Displaying all individual gains from each investment followed by the total gain via the text area and read-only textfield.


SEARCH INTERFACE

Testing involved:

- Making sure that the user must fill textfields with appropriate values in order to search for an investment.
    Ex. If inputting something invalid like a number wthin an ASCII field or an ASCII character within a number field, prompting the user to retry.
    Ex. If all fields are left blank, wrote a try-catch handler to catch the exception being thrown followed by a prompt to the user to enter something. 

- Making sure that the user had wide flexibility in choosing how to search for an investment.
    Ex. Tested for every combination of possible searches that can be made with the given search fields in the search interface.
    Ex. Outputted all investments meeting the search criteria of any given combined search option into the text area for verification that the functionality is intact.    

- Making sure the Reset button was properly clearing all textfields.
    Ex. Entered some values within the textfields and then clicked Reset to verify.


QUIT

Testing involved:

- Making sure that clicking the default X button at the top right of the gui frame terminates the program.
- Making sure that when selecting the menu item "Quit" from the menu bar, the program ends and the gui terminates.


(5) Potential improvements that could be added if I were able to do the assignment again and or have more time.

Some improvements that could be made include:

- Adjust the GUI interface to be more aesthetically pleasing.
- Integrating File I/O with the required GUI implementation. 
- Improving the search option using a robust HashMap to track all investments via keywords.

About

A Java-based application with a GUI for managing investment portfolios, enabling users to buy, sell, update prices, calculate gains, and search investments. Features include robust input validation, data persistence via file I/O, and efficient design using polymorphism, abstract classes, and a HashMap index for fast searches.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0