Answered step by step
Verified Expert Solution
Link Copied!

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 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.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications Dexa 2023 Workshops 34th International Conference Dexa 2023 Penang Malaysia August 28 30 2023 Proceedings

Authors: Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil ,Bernhard Moser ,Atif Mashkoor ,Johannes Sametinger ,Maqbool Khan

1st Edition

303139688X, 978-3031396885

More Books

Students also viewed these Databases questions