Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

currencies.txt is provided by course Algorithm solution to the problem: Prompt the user to enter source currency and store the input to variable sCurrency Prompt

currencies.txt is provided by course
Algorithm solution to the problem:
Prompt the user to enter source currency and store the input to variable sCurrency
Prompt the user to enter target currency and store the input to variable tCurrency
Prompt the user to enter original amount and store the input to variable a
Convert string variable a to float and store it to variable amount
Open File "currencies.txt" for read and assign the file object (IO channel) to variable f
The whole content of the file object f is read and stored in variable content
Close IO channel f
The items in string content is split based on separator "n" and stored in a list variable
lines.
For each line in List lines
Split line into a list items
Retrieve the first item (currency code) from list items and assign to variable code
Retrieve the second item from list items and assign it to variable q
Convert variable q to float and assign it to variable quantity
If code equals to sCurrency
Assign quantity to variable sValue
If code equals to tCurrency
Assign quantity to variable tValue
Calculate amount * tValue/sValue and assign it to variable result
Display the message with original currency and amount that equals target currency and
amount (result).
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

Step: 3

blur-text-image

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

Advances In Spatial And Temporal Databases 11th International Symposium Sstd 2009 Aalborg Denmark July 8 10 2009 Proceedings Lncs 5644

Authors: Nikos Mamoulis ,Thomas Seidl ,Kristian Torp ,Ira Assent

2009th Edition

3642029817, 978-3642029813

More Books

Students also viewed these Databases questions

Question

Explain the forces that influence how people handle conflict

Answered: 1 week ago