Question: Week 1 Lab Activities This lab provides more practice with files, stream manipulators, functions, and array - related tasks. Part I of this lab is

Week 1 Lab Activities
This lab provides more practice with files, stream manipulators, functions, and array-related tasks.
Part I of this lab is for you to create a program to process a file of currency exchange transactions from different foreign currencies to US Dollars. Each line of the "transactions.csV" file represents one exchange transaction using the following format:
currency_abbreviation, currency_name, amount
For example, the following sample "transactions.csv" file contains four transactions. The first one requests to exchange 150 Canadian Dollars to US Dollars. The second one requests to exchange 125 Brazilian Real to US Dollars. And so on. Not all currencies in the "transactions.csv" file have their matching exchange rates in the "rates.txt" file.
CAD, Canadian Dollar, 150
BRL,Brazilian Real, 125
MXN, Mexican Peso, 350
CUP, Cuban Peso, 199
Your program shall process the transactions and display the results in a nice columned format using parametric parameters, as illustrated in the following sample output. You don't need to match the exact number of spaces for each column. But there needs to be 2 digits after the decimal space for each currency amount.
\table[[Transaction,Foreign Amount,Currency Name,US Dollars],[1,150.00,Canadian Dollar 111.94,],[2,125.00,Brazilian Real 25.46,],[3,350.00,Mexican Peso,20.58],[4,199.00,Sorrv. no matchina currencv for CUP,]]
The following two function prototypes have been created in the "library. h" file. You are required to implement these two functions in the "library.cpp" file and call these functions in the main function.
double find rate(string abbreviation);
This function is to take the abbreviation of a currency and look up the "rates.txt" file to return the corresponding exchange rate. The function shall return 0 if no matching currency is found. Note that the "rates.txt" file stores the exchange rates from US dollars to different foreign currencies.
void convert(double foreign, double rate, double& dollars);
This function is to calculate and store the resulting US dollar amount in the third parameter using the values of the first two parameters.
When you are ready to submit your work, capture the screenshot of the sample run of your program. Upload the screenshot to your
Repl.it project. The lab instructor may ask you to explain your problem-solving process and the code. When evaluating your code on
Repl.it, the lab instructor may modify the content of the "rates.txt" and "transactions.csv" file.
 Week 1 Lab Activities This lab provides more practice with files,

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!