- For a given stock:
a. Given any price as input, calculate the dividend yield;
b. Given any price as input, calculate the P/E Ratio;
c. Record a trade, with timestamp, quantity of shares, buy or sell indicator and traded price;
d. Calculate Volume Weighted Stock Price based on trades in past 15 minutes; - Calculate the GBCE All Share Index using the geometric mean of prices for all stocks;
g++ -std=c++0x -o stockcalculator stock.cpp trade.cpp application.cpp stockcalculator.cpp
Make sure test_stockcalcultor does not exist.
To compile and run test program which follows basic TDD (Test Driven Design):
g++ -std=c++0x -o test_stockcalculator stock.cpp trade.cpp test_stockcalculator.cpp
Make sure stockcalcultor does not exist.
The design is simple and modular, with clean seperation of the various program actors as such:
The above architecture diagram shows a simple overview of the program.