Question: Foundations of Computer Science (C++) The API codes are at the bottom, read the instructions and finish coding the codes provided to you. The first

Foundations of Computer Science (C++)

The API codes are at the bottom, read the instructions and finish coding the codes provided to you. The first two files should work, when you include them in a visual studios project folder.

Foundations of Computer Science (C++) The API codes are at the bottom,

read the instructions and finish coding the codes provided to you. Thefirst two files should work, when you include them in a visualstudios project folder. The code underneath is cryptobroker.cpp /* * The program

implements and shows how to use following functions * Sell coins: letus say that somebody else has provided you with a C function:

The code underneath is cryptobroker.cpp

/*

* The program implements and shows how to use following functions

* Sell coins: let us say that somebody else has provided you with a C function:

* bool sell(double qty);

* Buy coin: The function available to you is bool buy(double qty);

* Check Price: double checkPrice() Will return the current market price of the currency.

*/

#include "cryptobroker.h"

#include

double sell(double quantity){

return quantity * currentPrice;

}

double buy(double quantity){

return quantity * currentPrice;

}

double checkPrice(){

//sleep(1);

//srand(time(NULL));

return currentPrice = 1000 + (0.5 - ((double) rand())/RAND_MAX)*RANGE;

}

void print(){

cout

}

void test()

{

// for(int i = 0; i

// checkPrice();

// print();

//}

double soldAmount;

double boughtAmount;

cout

soldAmount = sell(1.0);

cout

cout

boughtAmount = buy(1.0);

cout

}

The following code underneath is the cryptobroker.h file

/* * The program implements and shows how to use following functions * Sell coins: let us say that somebody else has provided you with a C function: * bool sell(double qty); * Buy coin: The function available to you is bool buy(double qty); * Check Price: double checkPrice() Will return the current market price of the currency. */ #ifndef CRYPTOBROKER_H #define CRYPTOBROKER_H

#include #include #include

#define RANGE 300

using namespace std;

extern double currentPrice;

double sell(double quantity); //Returns the $value of the coins sold. double buy(double quantity); //Returns the $value of the coins bought. double checkPrice(); //Returns the current value of one coin. void print(); void test();

#endif

The following code is the cryptobrokermain.cpp file

/*

* The program implements and shows how to use following functions

* Sell coins: let us say that somebody else has provided you with a C function:

* bool sell(double qty);

* Buy coin: The function available to you is bool buy(double qty);

* Check Price: double checkPrice() Will return the current market price of the currency.

*/

#include "cryptobroker.h"

double currentPrice = 0;

int main()

{

test();

return 0;

}

Requirements hisroblem, we will develop a nc trading opplication Background Currently the three most popular cryptocurrencies are: Bitcoin: Symbol BTC Ethereum: Symbol ETH Ripple Symbol XRP The concept is the same as trading stocks. You want to buy when the price is low, and sell when the price is high to make a profit. For professors and students it only makes sense to trade a fraction of a coin at a time Function Specifications You are invited to participate in refining the function specifications. They are (and always are) incomplete, they will improve but remain incomplete (always do so). This is how we develop products. You must ask questions when you do not understand. You must respond to questions when you know the answer. To keep it simple, we will assume that the user is interested in trading only one type of coin. The application will provide three options2 to the user

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!