assignment2.zip

Assignment2/A2-12-Feedback Sample.doc

There is no need to print this document.

These are sample feedback from assignment 2 from 2012. Student identification has been removed and there may be been some rewording (to make it more general) of the actual specific feedback that these students receive.

The application area was different in 2012, but the data structure requirements were the same. Tree and maps were mandatory then and are mandatory now.

You will find it instructive to go through this feedback when working on your assignment 2 as a lot of the feedback relates to the data structures that you are using now.

Also, going through these will give you an opportunity to learn from others as well.

ICT209 Assignment 2, 2012

Student Name:

Minimum Requirements:

Satisfied Y/N

UML diagram

Yes

Documentation asked for: Design outline including justification/rationale

Yes

Doxygen output

Yes

Program that builds and runs.

Yes

Source code with doxygen style comments. (soft copy only)

Yes

Test plan and output of test run(s)

Yes

Executable program with associated data files in a separate directory called “executable”. Make sure that the executable runs on a machine which does not have a compiler.

Yes

A declaration indicating what works and what does not work in your program. This can form the summary of your test plan and output of test runs and should be provided as a separate document called “evaluation.txt”

Yes

Components

Comments

UML diagram

UML is fine. All good.

Written rationale for the design + algorithm

Rationale for the maps is fine. It is a shame you didn't use your tree, because there is quite a heavy mark reduction for not using the required structures.

The templated BST is in the textbook. Should have attempted the lab exercise on trees first. This lab exercise had to be done anyway as it was assessed. If the lab exercise had been done, you would have worked out the operation of the BST much earlier and would have been able to incorporate the BST into the assignment.

There are plenty of options for combining the 2 structures; store dates in the tree, map dates to readings; store readings in the tree, map readings to dates; map dates with time/max reading. It didn't have to be cleanest answer, even if the rationale behind why you map/tree something seemed illogical, it still would have been better than getting the -30 marks for not doing it.

Algorithm is concise and clear; all good.

Program including coding style and comments

I was nearly going to put a no next to the doxygen minimum requirement, but then I found it pretty well hidden in your VS project files. I would have moved that to a more obvious location before submission. That said, your doxygen comments are good.

I get an assertion error while attempting to load the input data. But, this does correlate with your test data. Unfortunately though, it makes it hard to test to see if your application is functioning correctly or not.

Your coding style is okay. I only found one instance of an attribute without an obviously clear name, which was “ m” in your main application. That could be anything at a glance. It was a monthly reading though, so something like monthlyReading is much clearer.

Test plan and testing

To be honest, it is good to see someone who actually puts their failed test results in as well. It looks a lot more authentic to have tests that fail, because in the real world it happens all the time.

You made a comment about your test programs. I really needed to see the test outputs from the application as well to correlate them against the test plans. Since you have a column that says output in your test plans I am going to presume that was copied for application outputs.

Other advice (if any):

If you were having trouble creating the tree structure and working out where/how/why to use it, email me. I may not reply within 24 hours for various reasons, but we could have sorted that out within a few days.

Details of any penalties applied:

-30: BST was not used.

Number of days late: Late penalty (10 marks a day):

Final Grade:

ICT209 Assignment 2, 2012

Student Name:

Minimum Requirements:

Satisfied Y/N

UML diagram

Yes

Documentation asked for: Design outline including justification/rationale

Yes

Doxygen output

Yes

Program that builds and runs.

Yes

Source code with doxygen style comments. (soft copy only)

Yes

Test plan and output of test run(s)

Yes

Executable program with associated data files in a separate directory called “executable”. Make sure that the executable runs on a machine which does not have a compiler.

Yes

A declaration indicating what works and what does not work in your program. This can form the summary of your test plan and output of test runs and should be provided as a separate document called “evaluation.txt”

Yes

Components

Comments

UML diagram

Concise and clear. Where are the details for BST and BSTNode in the UML?

Written rationale for the design + algorithm

Perfectly fine rationales behind the use of the data structures.

From your rationales I can already see inconsistencies with method names though; start with capitals or lower case?

Program including coding style and comments

Where's your Code::Blocks project file? I had to create the project myself to see if it builds correctly. You had it in assignment 1's submission. I shouldn't have to add to a students submission to see if minimum requirements are meet (builds on VS or C::B). As it is the first time you have done this, I'll just give you a warning about it. Always submit the project files as well.

Your BST and BSTNode classes stand out from the rest of the project. Lack of UML data, lack of doxygen comments, and mostly written in a different coding style (different naming conventions for parameters, method, and attributes; different location for the { in the code blocks).

The inconsistencies of the BST and BSTNode classes can invite questions as to the authorship of these classes. If the code was sourced elsewhere and not referenced, it becomes plagiarism. Although I don't wish to imply that the BST code was sourced from elsewhere, it is inconsistent with the rest of the project, making it stand out. If say, for example, you get code examples from books, use them, and reference them. For example, BST code from the textbook could have been used and referenced.

Check you BST’s destructor. Deleting the root node doesn’t delete the tree. Please see the textbook which shows how this is done.

It does not make sense to expose the internals of the BST with a public getroot() method. Makes a mockery of the encapsulation that is done via the class mechanism.

The class declaration doxygen comments are good, but they should go directly before the declaration in your source. For example:

#include “someheader.h”

using namespace somenamespace;

/**

* @class example

* etc ..

*/

class MyClassName {};

The rest of your doxygen comments are very brief; just in the form of single line /// comments. There is a good example of a doxygen comments on the unit website @ Practice/DoxyExample/unzipped/ModelFile.h.

Generally, your code in clear enough to be read by a third party, so that's all good. It is important to focus writing readable code first.

Program execution is fine. No issues there.

Test plan and testing

Your test plans are fairly brief, but structured okay. I would have tried to have had a bit more detail here where possible.

Other advice (if any):

Reference sources, if you use them. Supply everything that requested (in this case, the code::blocks project file).

Details of any penalties applied:

Number of days late: Late penalty (10 marks a day):

Final Grade:

ICT209 Assignment 2, 2012

Student Name:

Minimum Requirements:

Satisfied Y/N

UML diagram

Yes

Documentation asked for: Design outline including justification/rationale

Yes

Doxygen output

Yes

Program that builds and runs.

Yes

Source code with doxygen style comments. (soft copy only)

Yes

Test plan and output of test run(s)

Yes

Executable program with associated data files in a separate directory called “executable”. Make sure that the executable runs on a machine which does not have a compiler.

Yes

A declaration indicating what works and what does not work in your program. This can form the summary of your test plan and output of test runs and should be provided as a separate document called “evaluation.txt”

Yes

Components

Comments

UML diagram

Your UML is simple, but accurately reflects your classes in your project. All good.

Written rationale for the design + algorithm

Although I feel the goals that your maps achieve could be handled by data validation in the date class, your rationale behind why you chose to implement your maps in a certain way is sound. So no issues there at all.

What I am having trouble finding is a rationale for why your tree contains the data it does. I may be missing something, but I read the Use of Data Structures: Maps & Binary Trees section twice, and the first two paragraphs state that the assignment needed a BST and that you had created one.

So I had a look at CustomeBinaryTree, and I see a lot of how, but not really why, it stores the data it does. I'm sure this only a misinterpretation of what you are trying to express. I'm not marking you down for it, but personally I feel it could have been stated clearer.

Program including coding style and comments

I had fun typing long sentences in the menu and watching the error message spam for every character in the sentence. It's good though, because the

application didn't break with inaccurate inputs.

Took me awhile to workout that when your asking the user to enter the month, they need to enter it as a word. Which is fine, but there would have to be a note for the user about the format for data input.

Other than that, your application works as intended. All good.

Your doxygen comments are nicely detailed, so that is all good too.

Test plan and testing

This is really good here. Lots of detailed testing. The test plans are fleshed out; the outputs are shown; each unit has been tested individually.

Probably not the most exciting part of a project to excel at, but your testing documentation is very good.

Other advice (if any):

It is good that you have a positive attitude towards coding, as expressed in your evaluation document. It really does help when attempting to write something.

Taking the feedback from assignment one on-board, your testing is great, and your doxygen comments are up to a good standard.

Details of any penalties applied:

Number of days late: Late penalty (10 marks a day):

Final Grade

ICT209 Assignment 2, 2012

Student Name:

Minimum Requirements:

Satisfied Y/N

UML diagram

Yes

Documentation asked for: Design outline including justification/rationale

Yes

Doxygen output

Yes

Program that builds and runs.

Yes

Source code with doxygen style comments. (soft copy only)

Yes

Test plan and output of test run(s)

Yes

Executable program with associated data files in a separate directory called “executable”. Make sure that the executable runs on a machine which does not have a compiler.

Yes

A declaration indicating what works and what does not work in your program. This can form the summary of your test plan and output of test runs and should be provided as a separate document called “evaluation.txt”

Yes

Components

Comments

UML diagram

UML looks fine. Had to really zoom in though to make it out -_-

Written rationale for the design + algorithm

It's good that you reference self-balancing trees. Everything comes at a cost though; self-balancing trees take much longer to input data as the tree is rearranging itself after each insert.

Rock solid rationale for your tree and map.

Clear, meaningful names for your methods and attributes. All good there.

Algorithm is good. It's quite long and detailed, but that's no issue.

Program including coding style and comments

Yes I did have the side-by-side configuration error again. But it's okay because you mentioned it in your evaluation document. But you do need to get this fixed.

Doxygen comments are good. I can see you have adjusted the little things from the first assignment, so no issues here whatsoever.

I like that you have extended the menu options to add more functionality. It's simple but effective.

I think your coding standard for a 2nd year unit is very good. Meaningful names, clear program flow, well commented; all good. But I have to pick on you for something, so I'd say more use of the const keyword. In particular after method declarations.

For example:

void IDontChangeAnything() const; and

void IChangeSomethingSoNotConst( const int& valueThatDoesntChange);

All things considered it is a minor consideration.

Test plan and testing

Test plan is good. The test methods correlate to the outputs. All good.

Other advice (if any):

Details of any penalties applied:

Number of days late: Late penalty (10 marks a day):

Final Grade:

ICT209 Assignment 2, 2012

Student Name:

Minimum Requirements:

Satisfied Y/N

UML diagram

No

Documentation asked for: Design outline including justification/rationale

Yes

Doxygen output

Yes

Program that builds and runs.

Yes

Source code with doxygen style comments. (soft copy only)

Yes

Test plan and output of test run(s)

Yes

Executable program with associated data files in a separate directory called “executable”. Make sure that the executable runs on a machine which does not have a compiler.

Yes

A declaration indicating what works and what does not work in your program. This can form the summary of your test plan and output of test runs and should be provided as a separate document called “evaluation.txt”

Yes

Components

Comments

UML diagram

This is, rather unfortunately, what I see in your documentation:

image1.png

Two large blank squares. You probably have done your UML and attempted to insert the images, but as I cannot see them at present, I will have to mark it down as a missing requirement. You could have provide the uml as a separate file and referred to this file in your write up.

Written rationale for the design + algorithm

As with the first assignment, having identifiers on your private member attributes (the m_) is very useful for people reading your code.

Although brief, and not actually under the section Written Rationale, I found a rationale behind why you used your map and tree the way you did. Which is good, as it was a requirement (the paragraph at the end of 5. Program).

Rationales are all good.

Algorithm is good too; no dramas.

Program including coding style and comments

Avoid using #define and global variables where possible. For starters, number of months is never going to change, also the months array is only used in 2 places; month_str_to_int and month_int_to_str. You could have mapped the date strings to integer values in your main, or possibly considered an enumerator to represent the months.

Your BST class uses a different naming convention to the rest of your classes. Also, add doxygen comments for your private methods as well. Other than that, no issues with your doxygen comments/outputs.

The program runs good. I'm not very concerned about how fast the application runs, as long as it runs correctly, which is seems to do. All good there.

Test plan and testing

No pass/fail column for your test plans? Other than that, your test plans and outputs are good.

Other advice (if any):

Double check your documentation after you save it in different formats.

If you do well in the exam this penalty may be reassessed.

Details of any penalties applied:

-50; missing UML.

Number of days late: Late penalty (10 marks a day):

Final Grade:

ICT209 Assignment 2, 2012

Student Name

Minimum Requirements:

Satisfied Y/N

UML diagram

Yes

Documentation asked for: Design outline including justification/rationale

Yes

Doxygen output

Yes

Program that builds and runs.

Yes

Source code with doxygen style comments. (soft copy only)

Yes

Test plan and output of test run(s)

Yes

Executable program with associated data files in a separate directory called “executable”. Make sure that the executable runs on a machine which does not have a compiler.

Yes

A declaration indicating what works and what does not work in your program. This can form the summary of your test plan and output of test runs and should be provided as a separate document called “evaluation.txt”

Yes

Components

Comments

UML diagram

Your UML is fine, but I can see inconsistencies in naming conventions for methods in the BST. Methods start with upper-case or lower-case? Either is correct, just be consistent.

Written rationale for the design + algorithm

Although you offer a rationale behind why some private attributes in the Power class are prefixed with m_ and some are not, they are still all private attributes and the m_ would identify that clearly to anyone reading your code. I recommended staying consistent with that in the future. Same thing with your node in BST.

Your rationales are fine, but it is bit long winded. Scientific documentation tends to be brief and concise (we're too easily distracted by shiny things and buttons). Leave the 3000 word essays to the Law students. It will save yourself a lot of typing on future assignments =)

A good example is your BST/Map rationale. If you supplied the list and reworded it slightly to express reasoning as well as purpose, that would be all you need.

Algorithm is good. Clear and concise.

Program including coding style and comments

#pragma are Visual Studio directives; they aren't portable to other compilers. Also, suppressing a warning instead of fixing it is like hiding the body under your bed and just hoping it will go away.

While we're on portability and re-use, the very first line of your program calls a batch file to execute a DOS command to generate a directory listing. Obviously this greatly reduces the portability of the code and also making the application dependant on the BAT file for operation.

Here is a C example of reading a directory listing: http://www.dreamincode.net/code/snippet2295.htm .

All those global variables again. The 101 Coding Standards #18 states: Declare variables as locally as possible. You had already written it for the first assignment and I wouldn't expect you to change previous work, but by having a line in your evaluation.txt document like, “I am aware that my global variables should be local variables, as per 101 coding standards”, completely covers you. It shows that you are aware of the issue, even if the issue hasn't been rectified directly.

Doxygen comments are good. All good there.

Test plan and testing

“Your evaluation documentation does not list what does and does not work in your program. If you feel your submission is working as intended then include something like, “All required features implemented and working.” in future submissions.” - quoted myself from your assignment one feedback.

Good test plan; simple and clear.

Other advice (if any):

The only thing that stopped you from getting a HD was your evaluation.txt document. Use it to list even the smallest things you think you could have done better and you won't get marked down for them. The example I gave above was the heavy use of global variables. As it is, your evaluation document only contains test outputs and I commented on that in the first assignment too.

Details of any penalties applied:

Number of days late: Late penalty (10 marks a day):

Final Grade:

ICT209 Assignment 2, 2012

Student Name:

Minimum Requirements:

Satisfied Y/N

UML diagram

Yes

Documentation asked for: Design outline including justification/rationale

Yes

Doxygen output

Yes

Program that builds and runs.

Yes

Source code with doxygen style comments. (soft copy only)

Yes

Test plan and output of test run(s)

Yes

Executable program with associated data files in a separate directory called “executable”. Make sure that the executable runs on a machine which does not have a compiler.

Yes

A declaration indicating what works and what does not work in your program. This can form the summary of your test plan and output of test runs and should be provided as a separate document called “evaluation.txt”

Yes

Components

Comments

UML diagram

Brief, accurate and detailed. All good.

Written rationale for the design + algorithm

I noticed your deleteNode method is not implemented. Delete node is also in the textbook. There is a fair amount of detail with diagrams, algorithm and code.

Also see http://www.algolist.net/Data_structures/Binary_search_tree/Removal . It has pictures and code examples.

What are you mapping your CollectedRecord struct to in your map in your rationale description? Record holds the date, units, time of max output, and max output; what is in the rest of the map?

Good clear method names in your design.

Algorithm is clear. All good there too.

Program including coding style and comments

Once again, no issues with the comments / doxygen ouput.

Menu is fine. Program functions accurately. No issues there.

Same as what I said in the first assignment; having the application as an interface shows a good understanding of object-orientation concepts. Having completed the games units your code is clear and well structured from experience with coding now.

In your BST I would have avoided C-style #defines of values. Consider possibly using a enum for the same result (your custom method can return enum values instead). It's not technically wrong by any means, only a suggestion.

Test plan and testing

This is more of a general formatting thing with your documentation than an issue with the way the information is presented, but using page breaks here so that each test starts on a new page would have made it look at lot clearer and easier to read.

Your test information is there, but it's not really structured in a test plan. Topic 8 has an example test plan document (the XLS link).

Other advice (if any):

Details of any penalties applied:

Number of days late: Late penalty (10 marks a day):

Final Grade:

ICT209 Assignment 2, 2012

Student Name:

Minimum Requirements:

Satisfied Y/N

UML diagram

Yes

Documentation asked for: Design outline including justification/rationale

Yes

Doxygen output

Yes

Program that builds and runs.

Yes

Source code with doxygen style comments. (soft copy only)

Yes

Test plan and output of test run(s)

Yes

Executable program with associated data files in a separate directory called “executable”. Make sure that the executable runs on a machine which does not have a compiler.

Yes

A declaration indicating what works and what does not work in your program. This can form the summary of your test plan and output of test runs and should be provided as a separate document called “evaluation.txt”

Yes

Components

Comments

UML diagram

UML is good. Relationships are accurate, public/private/protected is all accurately depicted, and attribute/method names correlate to your classes. So all good.

Written rationale for the design + algorithm

From assignment2.pdf; You must use the Binary search

tree data structure and the STL map (and/or multimap) data structure. You need to identify where these

data structures can be used and provide a rationale for their use. There is a 30 marks penalty if you do

not do this.”.

This is your rationale for the map and bst:

map<int,Record>; STL Template class; public;

Stores elements formed by the combination of a key value and a mapped value.

BinarySearchTree<int>; Template class; public;

Stores int elements in an ordered tree stucture. Used for fast searching.

You need to tell us why you are using these two structures in the way you are. What is the integer value stored in the map and the tree? Why is that integer mapped to a Record? What is a Record? There just isn't enough here to get around the -30 mark hit. See note at the bottom about penalties.

The rest of your rationales are fine.

Algorithm is good.

Program including coding style and comments

Tried putting invalid data inputs into your application. It didn't break it, but for example, if I put the word 'dog' in when the application is asking me to input a value to test against, then it treats each individual char in the string as a separate input, and loops through the process multiple times.

Data validation wasn't a requirement of the application, so it's not a big issue; just noting it. Otherwise your application seems to behave itself.

Once again your doxygen comments are very brief (see what I did there O_o). It's fine for the submission, but I was really hoping you would flesh the comments out with more details. There is a good example header file on the unit website @ Practice/DoxyExample/unzipped/ModelFile.h.

Your coding style is very good. Good use of the const keyword in particular. Clear, concise, easy to read; everything code should be really.

Test plan and testing

Test plans are clear; good. Outputs correlate. No dramas here at all.

Other advice (if any):

Ultimately, the only thing that let your whole submission down was the lack of rationale behind the use of maps and trees. But, if you do well in the exam then penalties may be re-evaluated. So it isn't the end of the world just yet.

Details of any penalties applied:

-30: Rationales for Maps and BST.

Number of days late: Late penalty (10 marks a day):

Final Grade:

Assignment2/Assignment2-T-16.rtf

file_0.wmf

file_1.wmf

ICT209 Assignment 2, Murdoch University 2016

9

ICT209 Assignment 2, Murdoch University 2016

file_2.wmf

ICT209 Assignment 2 20 16

Objectives:

Demonstrate that you can do Object Oriented design.

Demonstrate that you can write Object Oriented programs using C++.

Demonstrate that you can design and write programs using user defined data structures.

  • Demonstrate that you can use data structures appropriately.
  • Demonstrate that you can write test plans and show evidence of systematic testing.
  • Demonstrate that you can draw UML diagrams.

  • Acquire further experience with design and code maintenance.
  • You do not work in groups for this assignment as this is an individual assignment.

    Worth:

    30% of the unit

    Due:

    Midnight, end of Session 12 (last teaching week). See due date and time (and any amendments to these) in LMS. The due date and time depends on when is the last day of the last teaching week for the semester or trimester at the campus you are enrolled in.

    How to submit :

    Same way as assignment 1. The submission must contain the entire directory/folder in which the source was built. Other submission items are specified in this document.

    For submitting in LMS, zip up the entire folder. Make sure that you have included all needed files. Do not include temporary files or files not relevant to the assignment. After submitting the assignment, log out of LMS. Then log back in again. Check that the assignment is submitted.

    Name the zip file with the unit code, Assignment number, your name, student number. ICT209Asg2JoBlogs12345678.zip or alternatively,

    ICT209_Asg2_JoBlogs_12345678.zip Textual submissions should be type-written. External documentation can only be in the following formats: Text    (.txt) PDF    (.pdf) RTF     (.rtf)

    HTML (.html) Image formats : PNG, GIF, JPG, TIFF,  BMP. (BMP and TIFF cannot be used for Web documents) Assignment cover sheet requirements are listed in the unit outline found in the Admin area. Also see the end of this document.

    Mandatory Readings /work needed:

    Unit textbook. “ C++ Programming: Program Design Including Data Structures” by D.S. Malik.

  • Lecture notes.
  • Complete lab exercises.
  • You need to complete all exercises up to laboratory session 10 to cover the data structures requirements of this assignment.
  • Complete laboratory session 11 before submission of this assignment.
  • Question and Answer files ( QandA) in the assignment 2 folder.
  • C++ Coding Standards http://0-lib.myilibrary.com.prospero.murdoch.edu.au/Open.aspx?id=291948" http://0-lib.myilibrary.com.prospero.murdoch.edu.au/Open.aspx?id=291948
  • Assignment Question:

    Design an object-oriented solution and implement the solution in C++ to solve the problem described below. You must read the entire specification and work out what is needed before starting work on this assignment.

    Like assignment 1, this assignment is not for actually buying and selling shares. The assignment only deals with data from past share transactions (trades).

    The solution needs to be worked out on paper before you start coding.

    Extend assignment 1 to do the tasks described below. You need to also reflect on the design and code changes needed to convert your assignment 1 into assignment 2.

    Start early. Design the menu system and test to make sure the menu works. Use code stubs (refer to your earlier units) to test the overall flow of execution. If you have forgotten what a stub is, see http://en.wikipedia.org/wiki/Method_stub" http://en.wikipedia.org/wiki/Method_stub for a quick overview. You already have data file reading code, so make sure that you are able to read data files correctly. In the initial stages, read the files and print them out to check. Once this stage is completed, you start using the data structures after unit testing the data structures.

    Create your own test data files as given in these specifications below. You will be submitting these files.

    Make sure you design a simple menu so that users do not get confused or annoyed – consider what it is like if you were the end-user.

    Your program should be able to deal with course of sales data for multiple days and multiple stock exchange codes ( x-code). Each day’s trading data for each stock code ( x-code) is still stored in CSV files. This means that there will be a number of data files for each stock code. For proper testing (for the various test conditions), you need to create your own data files. These test data files shouldn’t be large. There should only be enough data to check the test conditions. This involves various x-code values and dates. You decide on these values and the decision is important as the data values are used to test your solution.

    Program input:

    The data format in each course of sales file is the same as assignment 1. As there are multiple x-codes, the date files are arranged in directories or folders. The folder names are the x-codes. To illustrate, assume there are course of sales data for 3 companies with their own x-codes. Assume the x-codes are IAG, NAB, CBA. The data folder will have 3 folders called “IAG”, “NAB”, and CBA”. This data folder will have an index file called code_index.txt. The contents of this index file would just be the x- code names whose folder exists in the data folder. The folder names match the x-code names.

    So, for this example, code_index.txt will contain each x-code on a line:

    IAG

    NAB

    CBA

    The contents of code_index.txt indicate that there are these 3 sub-folders in the data folder.

    Do not make any assumption that the x-code is sorted in code_index.txt.

    The course of sales files (in CSV format, as in assignment 1) for each day and given x-code will found in the sub-folder of the data folder. As indicated earlier, the sub-folder is named by the x-code. Do not make any assumptions about the naming conventions used for the course of sales files. The names of the files in the x-code sub-folders are listed in a file called sales_index.txt. Each x-code subfolder will have a sales_index.txt file.

    Assuming that the folder IAG has course of sales files day1.csv, day2.csv, day3.csv, the sales _index.txt file in folder IAG will contain the following lines.

    day1.csv

    day2.csv

    day3.csv.

    Do not assume that there is any sort order in sales_index.txt. The names of the CSV files do not indicate any chronological order. Arrange your data files to reflect this – change the order in which the files are listed and check.

    So to read course of sales data into your program:

    In the data folder, read the code_index.txt file.

    For each code in code_index.txt

    Read code/ sales_index.txt

    For each csv file in code/ sales_index.txt

    Load the csv file data into your program.

    Endfor

    Endfor

    The program reads all files and loads the appropriate data structures before the menu is displayed to the end user.

    Program output: The program reads data from the data files and produces output according to the menu option selected by the user. Assignment 2 deals with multiple stock codes and course of sales for multiple days. Consequently, most of the menu options are variations of what was needed for Assignment 1.

    Date is shown as dd/mm/yyyy. (02/01/2014).

    Time uses the 24-hour format.

    The stock code is the x-code.

    Read the requirements for each option, and design your menu system to be user friendly. Your design may have some of the menu options listed below as sub-menus.

    Before any menu option is displayed, the program reads all data files and loads the appropriate data structures.

    Menu option 1: The highest share price and start time(s) of the highest share price during the day for a user specified stock code and date. This is printed on the screen in the following format:

    Stock code: <the stock code> Date: <the transaction date> Highest price: <the highest price> Start time(s): <time when highest price transaction occurred> <time when highest price transaction occurred> ... The highest 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 2: The lowest share price and start time(s) of the lowest share price during the day for a user specified stock code and date. This is printed on the screen in the following format:

    Stock code: <the stock code> 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.

    A value of 0 for price should not be part of the output. Menu option 3: This option is for a user specified stock code and date.

    The output goes to a file called price-change- date .csv where the fields (individual items of data) are separated by commas. The date part of the file name depends on the user specified date. The format is yyyy-mm-dd. As an example, an output file can be price-change -2014-02-10.csv. This is the output for the 10th of February 2014. This file is created in the specified x-code directory.

    The output format is:

    Stock code, Date, Start time, Price of share, Volume of shares traded, Total value of shares traded

    Make sure you write the header row. This is the first row of the output file. This involves simply printing the format line above as a string.

    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:

    • Stock code: The x-code .
    • 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: This menu option is to be completed only when all other menu options are working as expected.

    Proper completion of this option will give you a 15 marks bonus. If you attempt this option when any of the other options are not working, no bonus marks would be awarded.

    It is theoretically possible to get 115 marks if all options are done perfectly. However the maximum mark that will awarded is 100.

    Calculate a simple moving average (SMA) for the price of a user specified stock code on a given date. The moving average is over 5 transactions by default. The output goes to a file named SMA-date.csv.

    The date part of the file name depends on the user specified date. The format is yyyy-mm-dd. As an example, an output file can be SMA-2014-02-10.csv. This is the SMA for the 10th of February 2014. This file is created in the specified x-code directory.

    The output format is:

    Stock code, Date, Time, Price of share, simple moving average.

    Make sure you write the header row. This is the first row of the output file. This involves simply printing the format line above as a string.

    Stock code and Date have the same meaning as in option 3. Time is the recorded time in the course of sales file. Price of share is the price recorded in the course of sales file. The SMA is described at http://www.investopedia.com/terms/m/movingaverage.asp" http://www.investopedia.com/terms/m/movingaverage.asp. Use the approach described at this site but instead of using daily closing prices, the actual transaction price at a given time recorded in the course of sales file is used.

    Provide a sub-menu of this menu that enables the default of 5 transactions for the moving average to be changed to some other value.

    Price values of 0 must not be averaged.

    Menu option 5: Exit the program

    Data Structures requirement:

    STL data structures and algorithms can be used in this assignment. You must use the templatized Binary search tree data structure and the templatized STL map (and/or multimap) data structure.

    The data for the output in the various menu options must come from these data structures. You may use other data structures together with the STL map and tree.

    You need to identify where these data structures can be used and provide a rationale for their use. There is a 30 marks penalty if you do not do this.

    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.

    When working on this assignment, think of the usability of your program from the point of view of the user . This is the first thing you have to do, even before you start designing the program. This will form the menu system for the running program. Y ou should not make the program more complicated than what is specified in the assignment. Make sure you provide an option to exit the program.

    Any advice and further clarifications to these requirements would be found in the QandA file in the Assignment 2 folder. Please ask your questions early and do not wait until near the due date as you may not have time to incorporate any answers into your assignment.

    Documentation (all in soft copy) :

    UML diagram showing the design of your classes.

  • Reflection on the changes you had to make to cater for the requirements of assignment 2. You describe what parts of your assignment 1 design and code enabled you to complete the requirements of assignment 2 easily. What parts of your assignment 1 design and code were a problem?
  • Rationale for the use of the data structures in the program.
  • A high level algorithm for the solution.
  • Doxygen output which shows all information as was done in the practice for session 2.
  • Test plan and output of the test run(s).
  • Do not print code. Code will only exist as soft copy. You need to submit the entire directory/folder where you built your program. All relevant data files need to be there and a way must be provided to build with either Microsoft Visual Studio or Code:Blocks on a Windows operating system.

    Minimum requirements:

    You must provide all of the following; otherwise 50 marks will be deducted.

    • UML diagram
    • Reflection on the design and code conversion from Assignment 1 to Assignment 2.
    • Written rationale for the data structures: tree, map/multimap and any others used.
    • Doxygen output
    • Program that builds (using Microsoft Visual C++ or code::blocks) and runs. Build mechanism must be provided.
    • Source code. Doxygen style comments in header files. (soft copy only)
    • Test plan and 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 which does not have a compiler. Data files needed to enable it run should be included here.
    • A declaration indicating what works and what does not work in your program. This can form the summary of your test plan and output of test runs and should be provided as a separate document called “ evaluation.txt ”. This is an unformatted text file and it is not the test plan or output of test runs.

    Marking

    UML diagram 10%

    Design reflection and rationale for data structures 20%

    Program (includes coding style and comments) 55 % + 15% bonus for menu 4

    Test plan and testing 15%

    There is a 10 marks penalty if the cover sheet is not filled in properly and/or the requirements of the coversheet are not met. If the cover sheet is not provided, you get no marks. There is a separate cover sheet available.

    If progress on this assignment is not demonstrated to your tutor in the weeks prior to the submission of the assignment, you may not get any marks for this assignment. We need to know that you have been working on the assignment. The assignment must not “magically” appear. Please check the unit guide for the requirements for passing the unit – section on “Determination of the final grade”.

    Penalty summary:

    Specified data structures not used: -30 marks

    Missing minimum requirements: -50 marks

    Cover sheet problems: -10 marks (cover sheet is not required now for LMS submissions, but you should ensure that all requirements are met for the cover sheet and submission into LMS.)

    The lowest total mark you can get is 0.

    School of Engineering and Information Technology

    file_3.png

    file_4.wmf

    ICT209 COVER SHEET used for Non-LMS submission

    Given Names

    Surname

    Student Numbers

    Mode (D/X)

    Email

    Name of tutor: _____________________________ Day & Time of tutorial: _________________

    Assignment Number: __2___ Due Date: ______________ Date Submitted: ______________

    If the given name by which your tutor knows you differs from your name on university records, you should indicate both names above. Tutor’s name must be entered. Penalty is 10% of the total marks for the submission for not providing information asked for.

    Your assignment should meet the following requirements. Please confirm this (by ticking boxes) before submitting your assignment that you have checked the declarations you need to make. Some items do not apply for online /electronic submission.

    Except where I have indicated, the work I am submitting is my own work for the purpose of this assessment and has not been submitted for assessment in another unit.

    This submission complies with Murdoch University's academic integrity commitments. I am aware that information about plagiarism and associated penalties can be found at http://www.murdoch.edu.au/teach/plagiarism/. If I have any doubts or queries about this, I am further aware that I can contact my Unit Coordinator prior to submitting the assignment.

    I acknowledge and agree that the assessor of this assignment may, for the purpose of assessing this assignment:

    • Reproduce this assignment and provide a copy to another academic staff member; and/or
    • Submit a copy of this assignment to a plagiarism-checking service. This web-based service will retain a copy of this work for the sole purpose of subsequent plagiarism checking, but has a legal agreement with the University that it will not share or reproduce it in any form.

    I have retained a copy of all submitted work.

    I will retain a copy of the notification of receipt of this assignment. LMS submission would provide the required receipt. If you have not received a receipt within three days, please check with your Unit Coordinator.

    Assignment is presented on A4 size paper and is neatly collated. (Internal students)

    Assignment includes virus-free disk with machine-readable programs & files relevant only to this submission. CD or DVD only may be accepted. (Internal students)

    Instructions relating to answering of questions, formats used for electronic submission and LMS submission have been followed.

    • Writing is clearly legible or has been printed.

    Pages have been firmly stapled. (Internal students)

    ____________________________

    Signature for submission via the assignment box (internal students)

    Assignment2/FeedbackTemplateA2.doc

    ICT209 Assignment 2, 2016

    Student Name:

    Minimum Requirements:

    Satisfied Y/N

    UML diagram

    Documentation asked for: Design outline, reflection, justification/rationale

    Doxygen output

    Program that builds and runs.

    Source code with doxygen style comments. (soft copy only)

    Test plan and 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 which does not have a compiler.

    A declaration indicating what works and what does not work in your program. This can form the summary of your test plan and output of test runs and should be provided as a separate document called “evaluation.txt”

    Components

    Comments

    UML diagram

    Design reflection and rationale for data structures + algorithm

    Program including coding style and comments

    Option 4 bonus (not looked at unless all other options are working)

    Test plan and testing

    Other advice (if any):

    Details of any penalties applied:

    Number of days late: Late penalty (10 marks a day):

    Final Grade:

    PAGE

    1

    Assignment2/QandA.txt

    Important advice about the assignment is next, followed by the QandA: Please read the requirements carefully and plan how you are going to tackle the problem. Do not code new functionality until you have completed the lab exercise on trees. (Topic 9 and lab 9) You should of course clean up your assignment 1 code to make it ready for assignment 2. This includes changing the menu code, any other classes you may have had to deal with the data in assignment 1. Substantial changes to the class code to cater for new requirements would normally imply that your original design was not very good. This is not a big issue because you are still learning but you need to be conscious of this and think of how you could have designed the classes better. Classes need to be cohesive; class behaviours (methods) need to be minimal and complete, functionality of any public method must not be duplicated in another public method - no duplication of functionality in public methods; friends are to be avoided; data structure classes do not do I/O, nor do they handle formatting issues - should have discovered this after completing lab 5. Everything that is pointed out out above applies to all OO and to whatever implementation language you are using. In fact, all of these ideas existed in Computer Science before any of the languages you know about existed. We usually cover details of the Computer Science theory for this in another unit. Keep in mind that just because you can write C++ code (or Java, Javascript, VB, C#, F#, .. etc) does not mean that you are doing OO properly. OO design happens *before you write any code*. The language only implements your design - the virtual level of abstraction. ____________________________QandA__________________________________ The latest QandA is the one shown first. If you are reading this for the first time, read from the bottom to the top. Q: So I'm interaction with my BST primarily through function pointers and they appear to be working correctly but when I try to used a callback with one of my traversals passing the pointer crashes the program. and I check that it's not crashing in the traversal function, it doesn't even make it into the function. the function is static so I simply pass it in as ClassName::FunctionName I use other function pointer similarly earlier in the program and they appear to be operating correctly (eg I pass insert a compare function) A: See testTree.cpp in the assignment 2 area. It is annotated and the approach is described in this QandA file. Q: Quick Question again! So for Option 4, price value of 0 would not need to be in the output? A: The question specifies that 0 should not be used in calculation of SMA, so no output of 0. Q: Do we assume that course of sales file is sorted by time in descending order? A: You can assume the order that was in the assignment 1 data file. Q: Should the simple moving average directly work on course of sales file itself, or should be first sort the transaction in ascending order? A: It needs to work in increasing time order. It makes no sense for it to work backwards. Q: Also for my assignment 1 in question 3, I had changes of price as 564, however 559 is the right answer. Are we able to obtain the sample for that output for question 3. A: Yes, use the sub-totals function in the spreadsheet to work it out for you. Q: Quick question for menu option 4. As we are doing it in lots of 5 transactions, does that mean that the SMA for the first four prices would be 0? A: See the worked calculation provided in the link. Use the same approach. There is no sma for the earlier ones. 0 is a valid value, so this can't be used. Leave blank. Q: it's it fair to assume that within 1 csv there wont be any duplicate times? A: No, you can't make that assumption. See data file from assignment 1. Whatever was valid for the data file in assignment 1, is also valid now. Q: I'm having trouble working out where the Binary Search Tree would be used. The only unique keys would be the file names but I don't know why I would need to do any traversals on the files. I do need to do traversals on the data within the files (menu option 3), however I can't use a BST to do it because there is no unique key for that data. A: There is if you think about how the data is organised. Take a step back from the code, and look at the data organisation. What you want to be able to do is use the assignment 1 design/code at the design/core of assignment 2 with little or no modification to the assignment 1 design. Then both the map and tree data structure usage becomes somewhat obvious. Q: If our code doesn't work, or things like the Doxygen output or StarUML diagram isn't finished, do we still lose 50 marks for "Not including the bare minimum", if we submit the unfinished/nor working parts correctly? A: No, you don't lose 50 marks if you submit the unfinished parts correctly. For example, if you have a program that runs and then crashes, and you place the exe file along with the data files into the executable directory, then you are not going to have 50 marks deducted. In a situation like this, you would want to make sure that you highlight the crashing in the evaluation.txt file. Q: I've been looking around the internet for resources on reading file directories, and a lot of people recommend using the dirent.h header file. From what I understand though, the header file is not standard for windows, so I was wondering if we would be able to use it, and whether we would have to include a copy of the file in our submission. A: dirent is the usual way to go. You will learn more about this in another unit. For this unit (ict209), it is not needed as the names of the directories (stock codes) are stored in code_index.txt files. The actual course of sales files are listed in the sales_index.txt file in each directory. See the description and high level algorithm given in the assignment question. Q: Can I use Visula Studio 2012? A: I have not heard of Visula Studio, but if you mean Visual Studio, the unit guide specifies only Visual Studio 2010 or codeblocks. If your source does not build in either of these, it would mean that minimum requirements were not met. You need to provide a build mechanism too. Q: I was just wondering if it's possible to pass a function with a parameter to a binary search tree? Here is the function that I am passing: portfolio.inOrder(MonthPurchased); However both month and year are global variables. I would like to pass them as arguments instead. A: No, that is not how it works. You pass a function pointer (only an address) to the tree. The function pointer points to a function outside the tree and this function can accept parameters. The tree calls this function and sends the parameter. The textbook example demonstrates this. The data in the parameter must come from the tree. If this function needs other data, this data needs to be "global" to the function. But if this "global" data is global to the program, then it is not good design - avoid using global variables. So a better solution is to have this other data as part of a class private area and the function pointer that is sent to the tree is pointing to a method of the class. As it is a method of the class, it will have access to this data and because the data is declared as private, the data is encapsulated and like any other private data of a class is not global to the program. So you use the mechanics of the programming language to get the good design you want and C++ lets you do this. The mechanism for doing this is already described in the QandA - please scroll down. Q: I understand that we can pass a function as an argument in the traversal functions. However this function can only modify the values not return them. I am able to use the callback function to place pointers to the elements of the tree in a global variable. I was wondering if there is a way to use the callback function to return the items (or pointers to the items) without using a global variable? A: The callback routine (in the client) can be sent the data by the tree and you can do whatever you want with this particular data. But if you want to keep all the data that is coming back from the tree, the easiest way is to use a global. The better way is to send a ptr to a static method of a class. When the tree calls the method of this class, the method stores the data being returned in a static data structure that is private to this class. This data struct can be a simple array or a vector or something else. If you have time, try it out in prac 9 with the unit object. // client class used to collect data returned from tree traversals class A{ // use meaningful names. this is just an illustration of the approach public: static void f1(Unit& d){ // assume the Unit class from prac 9 // this is the call back. d comes in, you print it out or keep track of it in a static data struct // so store in the private b array (in this case) or vector or .. whatever but use better names } // other methods ... doesn't have to be static private: static Unit b[100]; // Unit from prac 9. most simple form just an array but could be a vector, ... etc ... other stuff that you might need }; // the next line is needed for static data - check textbook Unit A::b[100]; // this creates memory. the declaration above makes it private so can't access like a global. For everything else, follow the design of classes we have talked about. For example you need a public method to access data stored in b. ======== How to use in the client BST<Unit> bu; // your tree of units from prac 9 - use better names than this A a1; // for collecting all the objects sent by the traversal - use better names than this // do stuff like insert unit objs into tree bu. bu.inOrder(A::f1); // will call the static method f1 of A if you got the function pointers working // alterntively bu.inOrder(a1.f1); // object.method notation passing the function pointer // after this call to inOrder, object a1 will contain all the unit objects returned by the bu.inOrder. Assuming you coded the body of f1 correctly. Don't make it un-necessarily complicated. The code in f1 should look obvious. f1 is the setter/insert for A. It just happens that you sent this setter/insert to the tree. Q; From the UML diagram comments: 1)You have said that: "Date’s setdate takes in a string parameter. This creates a dependence on the format. If a different format is required, this method would need to be modified. So it is not future-proofed." Which I can understand, but then in the Trans action class, where I have provided SetQuantity(quantity: unsigned) and SetQuantity(quantity: string) you have said: "Transaction is a little bloated. Functionality is duplicated. Same date is passed just with different types float and string." A: "Same date..." meant data. Yes, only one way is to be provided. It is quantity and quantities are communicated using numbers. Whether the data is read in as a number, or as string or as a series of binary digits is not Transaction's problem. Q: So I’d like to know what the best solution for this is. Using the SetDate as an example, should I just provide 1 SetDate method that takes all unsigned variables - SetDate(unsigned: day, unsigned: month, unsigned: year)- than let any other class or Main program that calls it deal with the data format? So the Main program might take in a string in "dd/mm/yyyy" format, then split the string, convert to an unsigned variables day, month, year, then call the SetDate(day, month, year) method? Wouldn’t this style make the Main program messy because we’d need to do extra processing to accommodate the necessary data type changes? A: Format is a client problem - so client (main) has to deal with this. It is up to the client to come up with a clean approach. The date class design should not be ruined and a coupling to date format introduced to deal with issues like this. Q: My intention was to make the class as flexible as possible with the data formats, but I do remember you saying that methods are like holes through a firewall. The more you have, the less secure it all is. A: Yes about the holes. Introducing coupling to client side issues actually reduces flexibility. Once you have completed the class, it should not be touched again to deal with issues like the client wants the format to be different. If the client wants the format to be different, the client can put a wrapper around the date class. An object is designed to have behaviour that is consistent with the object's nature. All of this is *not* just about C++. It is about any OO design and programming that you might do. Q: From the Program including coding style and comments: 2)You have said: "Doxygen comments shouldn’t tell how something is done." For example //** /// /* @brief Return value of m_size/// /* @warning None/// /* /// /* Unsigned function to return value of unsigned variable/// /* m_size as a constant/// /* /// /* @return value of private m_size member/// /* @pre None/// /* @post m_size value returned/// /*//// /unsigned GetSize() const;/ // Saying that it returns private m_size, defeats the whole purpose of information hiding and preventing client dependencies from occurring." What you should say, it returns the size of the vector. A: The doxygen comments must treat the class and the methods as black boxes. Q: 3)You have also said: "In .h files, do not include other .h files which are not needed. Date.h has got the following: #include <iostream> // why? #include <string> // ok but indicated design issue see earlier #include <sstream> // why stringstream code in the .h? #include "EXCEPTION.h" // are exceptions dealt with in the .h? Most of the above is needed in date.cpp. So include these there." I think the penny has finally dropped on this one. The header file is purely and simply that a header file only. It should only say the information the public need to know, for both methods and variables. #Includes and anything else needed only for programming shouldn’t be included in the header file. A: Yes, that observation is correct. Q: I realise that stl::map stores its data in a balancing BST using the key to sort, but for the assignment you asked that we use both the stl::map and our own BST. I'm not sure whether to have our BST like stl::map and encapsulate stl::map or something else A: This is a good question. As the user of the map, you must *not* assume anything about how the map data is stored. The map is *known only by its public behaviours* otherwise you introduce a coupling between the client (your program) and private parts (data or algorithm) of map. Defeats the whole purpose of having private and information hiding. So for the assignment, you use the BST you built and the map - two different data structures. Q: Are we allowed to use more than one tree? I thought I could use only one tree and map. A: It wasn't ever a case that no one was allowed to use multiple trees. It is usual that some people don't realise that because a class exists, multiple objects of that class can be created. This is after all a good reason for creating a class - so that it can be reused. So a vector of trees, queues of trees, stacks of trees, trees of vectors, trees of queues, trees of stacks, trees of trees, maps of trees .. etc are possible. There are so many choices. So the best way is to make (and unit test) the templated tree needed (Prac 9b) and then step back from the code and look at the requirements of the problem to be solved along with the specified constraints and think at the highest (most abstract) level what a solution can be and why. If you think at the code level, then the chances of getting lost in the detail is high. It will be a case of "missing the forest for the trees" (no pun intended). Q: Is there an perfect way to use the tree and map in the assignment? A: The intention was that there shouldn't be. If there is perfect way, then there is not a lot of thinking involved to meet the data structure constraints on the assignment. I am looking for what is going on in your mind when you made the choice of where you going to use the tree and map. Q: How much testing do I need to do? A: There is the usual unit tests to make sure that each class you have created, works. All methods of the classes must be tested to make sure that what you expect is what you get. A test plan that is created when you doing the class design in UML should list the tests. Then there is a test which check all the classes working together. This is usually the test for the program that solves the problem (in this case, the assignment). Again, a test plan would show what is to be tested and why. As part of the test, you need to demonstrate the the calculations work as expected. This means that you have test data covering the necessary conditions. You would have calculated the expected output manually. The program is run with this test data as input and you need to check that the program gives the expected result. You would have a number of buy transactions and a number of sell transactions. The last sell transaction to be considered needs to account for earlier sell transactions. It is important to make sure that calculations are correct. Simple errors can cause significant problems and really hurt a lot of people. One example is the goto fail problem in Apple's code. This was incorrectly written if statement and this wasn't tested or reviewed by someone else. See discussion of it here: https://www.imperialviolet.org/2014/02/22/applebug.html (problem is described here) https://news.ycombinator.com/item?id=7281378 (some discussion of the problem) Source code where the error was supposed to have occurred: http://opensource.apple.com/source/Security/Security-55471/libsecurity_ssl/lib/sslKeyExchange.c For some examples of the consequences of errors, see this NYT article by a Nobel Laureate titled "The Excel Depression" where one of the questions asked is ".. did an Excel coding error destroy the economies of the Western world?" http://www.nytimes.com/2013/04/19/opinion/krugman-the-excel-depression. html. A follow-up on this same topic is http://www.nytimes.com/2013/04/26/opinion/krugman-the-one-percents- solution.html which discusses the snowball effect of error. Q: What is "mimimal but complete"? A: Follow the KISS principle as *originally* envisaged by the person who created this idea. See http://en.wikipedia.org/wiki/KISS_principle#Origin (sections on "Origin" as well as "Variants" and what Antoine de Saint Exupéry had to say about perfection has been a past repeated exam question. You need *not* have heard of Antoine, but what he said about perfection would make total sense in the design of software systems. Scroll one page up to see section on "Quotations" http://en.wikipedia.org/wiki/Antoine_de_Saint_Exup%C3%A9ry#See_also. Q: I thought from your lecture that "this->" was used to de-reference class member pointer objects? Any chance you can explain the difference with *this? A: Within a class, a member can be referred to as either the member name on its own or via the "this" pointer. Example: class A{ public: f1(int b); private: int data; }; // all 3 ways to assign to private member data mean the same thing. // the pointer "this" exists only when the object exists and so the "this" // pointer is not available in static methods A::f1(int b){ data = b; //1st way this->data = b; //2nd way (*this).data = b; //3rd way } The 2nd and 3rd way uses the "this" pointer and are equivalent. The 3rd way de-references this to get the object pointed by "this" first, then the object.name notation is used to access the member. You can think of it like this: When a class client uses the class, an object of the class is created. A obj1; obj1.f1(5); // can be imagined as if the compiler arranged for a pointer // to obj1 to be passed in as a hidden // parameter to method f1 so imagine that the call was f1(&obj1, 5); // within f1, the hidden pointer to itself, i.e. obj1, is named "this". // note that obj1 is an object of class A. Q: Is this assignment like using binary search tree, map and vector(assignment 1 bring over) or we can just use binary search tree and map A: You need to use the tree and map and explain why. It is up to you if you want to use the vector from assignment 1 as there is no requirement which says that you must use the vector from assignment 1. Q: I can do the assignment without using the tree or map. It works and does what is required according to the question. Must the tree and map be included? A: The assignment can be done in many ways where no tree, map or even vectors are used. In fact, the assignment can be done without any Object Orientation. But the specifications require Object Orientation and the use of both the tree and the map. You must use both tree and map. And you need to also provide justification for their use. This justification is *not* because the specification asked for it. You need to think of the properties of trees and maps and the justification needs to be related to their properties. You may have to think really hard about this because it is possible that trees or maps might not really needed for this assignment but you need to make a case for their use. You can provide the justification in the same table as the data dictionary. If you do no do what is asked, there is a 30 marks penalty. There are also other penalties that you should be mindful of. See assignment question.

    Assignment2/sample_data.zip

    data/CBA/sales_index.txt

    data/code_index.txt

    CBA IAG NAB

    data/IAG/day1.csv

    Course Of Sales Time,Price ($),Volume,Value ($),Condition 10/10/2013 04:57:27 PM,5.81,5000,29050.00,LT XT 10/10/2013 04:48:05 PM,5.81,62728,364449.68,SX XT 10/10/2013 04:10:33 PM,.00,0,.00, 10/10/2013 04:10:33 PM,.00,0,.00, 10/10/2013 04:10:33 PM,.00,0,.00, 10/10/2013 04:10:33 PM,5.81,451,2620.31, 10/10/2013 04:10:33 PM,5.81,5000,29050.00, 10/10/2013 04:10:33 PM,5.81,145,842.45, 10/10/2013 04:10:33 PM,5.81,9241,53690.21, 10/10/2013 04:10:33 PM,5.81,8759,50889.79, 10/10/2013 04:10:33 PM,5.81,1875,10893.75, 10/10/2013 04:10:33 PM,5.81,58,336.98, 10/10/2013 04:10:33 PM,5.81,1370,7959.70,

    data/IAG/day2.csv

    Course Of Sales Time,Price ($),Volume,Value ($),Condition 15/12/2015 04:57:27 PM,5.81,5000,29050.00,LT XT 15/12/2015 04:48:05 PM,5.81,62728,364449.68,SX XT 15/12/2015 04:10:33 PM,.00,0,.00, 15/12/2015 04:10:33 PM,.00,0,.00, 15/12/2015 04:10:33 PM,.00,0,.00, 15/12/2015 04:10:33 PM,5.81,451,2620.31, 15/12/2015 04:10:33 PM,5.81,5000,29050.00, 15/12/2015 04:10:33 PM,5.81,145,842.45,

    data/IAG/day3.csv

    Course Of Sales Time,Price ($),Volume,Value ($),Condition 20/05/2015 11:24:55 AM,5.85,148,865.80, 20/05/2015 11:24:34 AM,5.84,124,724.16, 20/05/2015 11:24:28 AM,5.85,148,865.80, 20/05/2015 11:24:24 AM,5.84,364,2125.76, 20/05/2015 11:24:03 AM,5.85,1,5.85,CX 20/05/2015 11:24:01 AM,5.85,14,81.90, 20/05/2015 11:24:01 AM,5.85,17,99.45, 20/05/2015 11:24:01 AM,5.85,118,690.30, 20/05/2015 11:23:49 AM,5.84,336,1962.24, 20/05/2015 11:23:40 AM,5.84,93,543.12, 20/05/2015 11:23:39 AM,5.84,310,1810.40, 20/05/2015 11:23:36 AM,5.84,167,975.28, 20/05/2015 11:23:31 AM,5.84,734,4286.56, 20/05/2015 11:22:58 AM,5.85,73,427.05, 20/05/2015 11:22:58 AM,5.85,39,228.15, 20/05/2015 11:22:58 AM,5.85,36,210.60, 20/05/2015 11:22:16 AM,5.85,65,380.25, 20/05/2015 11:22:16 AM,5.85,83,485.55, 20/05/2015 11:21:58 AM,5.85,844,4933.18,CX

    data/IAG/sales_index.txt

    day1.csv day2.csv day3.csv

    data/NAB/sales_index.txt