Input: A list of currency exchange rates separated by ';'. A currency pair to calculate separated by '|' from the rest of the input. Output: Calculated exchange rate for the provided currency pair. Required precision is 2 decimal points. If you cannot calculate the exchange rate the expected output should be: 'Unable to determine rate for '. Examples Example 1 Input: EURUSD:1.20;USDGBP:0.70| EURGBP Output: EURGBP:0.84 Example 2 Input: EURUSD:1.20;USDGBP:0.70|GBPEUR Output: GBPEUR:1.19

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter5: Making Decisions
Section: Chapter Questions
Problem 4PE
icon
Related questions
Topic Video
Question

Java

Input:
A list of currency exchange rates separated by ;'. A currency pair to calculate separated by '' from the rest of the input.
Output:
Calculated exchange rate for the provided currency pair. Required precision is 2 decimal points.
If you cannot calculate the exchange rate the expected output should be:
"Unable to determine rate for <currency pair>'.
Examples
Example 1
Input:
EURUSD:1.20;USDGBP:0.70 EURGBP
Output:
EURGBP:0.84
Example 2
Input:
EURUSD:1.20;USDGBP:0.70|GBPEUR
Output:
GBPEUR:1.19
Transcribed Image Text:Input: A list of currency exchange rates separated by ;'. A currency pair to calculate separated by '' from the rest of the input. Output: Calculated exchange rate for the provided currency pair. Required precision is 2 decimal points. If you cannot calculate the exchange rate the expected output should be: "Unable to determine rate for <currency pair>'. Examples Example 1 Input: EURUSD:1.20;USDGBP:0.70 EURGBP Output: EURGBP:0.84 Example 2 Input: EURUSD:1.20;USDGBP:0.70|GBPEUR Output: GBPEUR:1.19
Example 3
Input:
EURUSD:1.20;USDGBP:0.70|GBPJPY
Output:
Unable to determine rate for GBPJPY
Example 4
Input:
EURUSD:1.20;USDGBP:0.70;GBPJPY:154.92|EURJPY
Output:
EURJPY:130.13
Transcribed Image Text:Example 3 Input: EURUSD:1.20;USDGBP:0.70|GBPJPY Output: Unable to determine rate for GBPJPY Example 4 Input: EURUSD:1.20;USDGBP:0.70;GBPJPY:154.92|EURJPY Output: EURJPY:130.13
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Instruction Format
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT