Design an object-oriented solution and implement the solution in C++ to solve the problem with the specifications given below.
Shares are traded on the stock market and the transactions are recorded in course of sales files for each share code on the stock market.
Each day's course of sales for a particular stock is recorded in one file. For assignment 1, you will be working with only one stock and one course of sales file. This is the share trading information for one company on a particular day. The data file that is provided contains actual share transaction data on a particular day, for a particular company listed on the Australian Stock Exchange. The company name or stock code is not relevant for assignment 1 but can be relevant in future iterations of the assignment.
Each data row shows the date-time, the price at which the stock was traded, the volume of shares traded, the monetary (dollar) of the shares traded and a condition field that is not relevant to the assignment.
Examine the data file in a spreadsheet to work out the meaning of the data. For programming purposes, you will need to examine the data using a text editor. The text editor for Visual studio or Codeblocks should show you the nature of the data file.
The program reads data from the data file and produces output according to the menu option selected by the user
Date is shown as dd/mm/yyyy. (02/01/2015).
Time uses the 24-hour format.
Menu option 1:
The highest share price and start time(s) of the highest share price during the day. This is printed on the screen in the following format:
Date: < the transaction date >
Highest price:
Start time(s): < time when highest price transaction occurred >
< time when highest price transaction occurred >
...
Menu option 2:
The lowest share price and start time(s) of the lowest share price during the day. This is printed on the screen in the following format:
Date: < the transaction date >
Lowest price: < the lowest price >
Start time(s):
< time when lowest price transaction occurred >
< time when lowest price transaction occurred >
...
The lowest price could be reached more than once during the day. If so, list each time on a new row. Do not list duplicate time values.
Menu option 3:
The output goes to a file called output.csv where the fields (individual items of data) are separated by commas.
The output format is:
Date, Start time, Price of share, Volume of shares traded, Total value of shares traded
The data file will have a record (row) for each time the share price changes. The output will have data arranged in increasing time order.
The output fields have the following meanings:
Treat a value of zero (0) for the price field in the input data file the same way as other prices are treated.
Menu option 4:
Exit the program
Make sure the design is modular to cater for future iterations of the assignment requirements. For example, future iterations may require handling of multiple stock codes and multiple dates. New output requirements may be needed.
If you do not attempt to "future-proof" your design, you will find that you will be re-doing all (or most) the work to cater for new requirements within a restricted time frame.
Heed the advice and lessors learned in laboratory session 5. Complete all readings from topic 1 to 5 before starting to work on this assignment. You can of course write small programs to test out ideas: like how to read and extract data from the given data file; test out algorithms for doing the required processing and unit test basic classes like the Date class for use in this assignment. Completion of laboratory exercise 5 is important for this assignment.
You may want to reuse the date class from the laboratory exercises. A vector class must be used and you must write your own minimal and complete template vector class to store data in a linear structure (see laboratory exercise for session 5). For the purposes of the assignment, a vector class is a dynamic array encapsulated in a class. Access to the private array is through the vectors public methods. The name of this template class will be Vector. To better understand this requirement, you should complete the textbook chapter on Overloading and Templates.
As indicated earlier, you should design your classes so that they can be used in the future with different specifications of this assignment. See the session 5 exercise where you are asked to future-proof your design
You should be careful that you do not have data structure classes that do I/O. I/O may be there for debugging purposes only. If you have data structure classes that do I/O, you will have to a lot more re-coding (i.e. a lot more work) when the I/O requirements change. You may want to have dedicated I/O classes instead.
STL data structures cannot be used in this assignment.
You may use std::string and string stream classes in your program instead of using C like strings. You may use iostream and file handling classes and objects in C++. See laboratory exercises.
Any advice and further clarifications to these requirements would be found in the QandA file in the assignment 1 area. Questions and Answers (if any) would also be found in this file.
You must provide all of the following;