Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 Lab Activities
This lab provides more practice with files, stream manipulators, functions, and arrayrelated 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:
currencyabbreviation, currencyname, amount
For example, the following sample "transactions.csv file contains four transactions. The first one requests to exchange Canadian Dollars to US Dollars. The second one requests to exchange 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,
BRLBrazilian Real,
MXN Mexican Peso,
CUP, Cuban Peso,
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 digits after the decimal space for each currency amount.
tableTransactionForeign Amount,Currency Name,US DollarsCanadian Dollar Brazilian Real Mexican Peso,Sorrv. no matchina currencv for CUP,
The following two function prototypes have been created in the "library. file. You are required to implement these two functions in the "library.cpp file and call these functions in the main function.
double find ratestring 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 if no matching currency is found. Note that the "rates.txt file stores the exchange rates from US dollars to different foreign currencies.
void convertdouble 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 problemsolving 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.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started