Assignment Question:

Design an object-oriented solution and implement the solution in C++ to solve the problem with the specifications given below.

Program input:

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.

Program output:

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:

  • Date: Date of trading
  • Start time: The time when the share price changed to the value indicated in the "Price of share" field. This time value is used to indicate that the share price changed to a new price value. The input data file may have multiple consecutive records (rows) where the share price is the same. This means that there may be multiple consecutive share transactions where the share price remained the same. In the output data file, output.csv, the Start time field records when the share price changed to a different value. The intention here is that this field records the time of initial change to a price in a series of consecutive same price transactions.
  • Volume of shares traded: The number of shares traded since "Start time" at the value indicated in the "Price of share" field.
  • Total value of shares traded: The total monetary (dollar) value of the shares given in the "Volume of shares" field.

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

Processing advice:

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.

Data Structures:

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.

Documentation:

  • UML diagram showing the design of your classes. (printed and soft copy)
  • Data Dictionary to accompany the UML diagram.
  • Rationale for including each method and attribute in your vector class and any other class that you write. You need to also explain why you named each attribute and method in a particular way. It is not acceptable to say that is how others do it. We would like to know why you designed something in a particular way i.e. what is your thinking behind the design. To simply the submission you can add an extra column to the Data Dictionary shown in Lecture 11. Label the column Rationale.
  • A high level algorithm for the solution.
  • Doxygen output which shows all information - as was done in the practice for week 2.
  • Test plan.
  • Output of the test run(s).
  • Executive summary indicating what works and what does not work. The name of the softcopy file is evaluation.txt. This file gets created using a text editor.

Minimum requirements:

You must provide all of the following;

  • UML design and Data Dictionary (diagrams should show high level and the detailed version)
  • Written rationale for the design answer why you did something in a particular way. What it does, is written in the comments and not in the rationale. To simplify submission, this can be inserted as a column in the Data Dictionary table.
  • Algorithm
  • Doxygen output
  • Program that builds (using Microsoft Visual C++ 2010ii or Microsoft Visual C++ 2012 or the latest edition of code::blocks) and runs.
  • Source code with doxygen style comments.
  • Test plan
  • Output of test run(s)
  • Executable program with associated data files in a separate directory called executable. Make sure that the executable runs on a machine that does not have a compiler. All associated data files must be provided here too.
  • A declaration indicating what works and what does not work in your program. This declaration should be provided as a separate document called evaluation.txt. The declaration is a summary of your test plan and output of test runs. Test plan and output of test runs have a lot of detail and are separate documents. The file evaluation.txt is only a summary like an executive summary.
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.