Question: 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).
 currencies.txt is provided by course Algorithm solution to the problem: Prompt

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!