Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use java to solve this problem, thanks, using the starter code Currency Exchange Programming challenge description: Given A list of foreign exchange rates A selected

Use java to solve this problem, thanks, using the starter code

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Currency Exchange Programming challenge description: Given A list of foreign exchange rates A selected curreny A target currency Your goal is to calculate the max amount of the target currency to 1 unit of the selected currency through the FX transactions. Assume all transations are free and done immediately. If you cannot finish the exchange, return -1.0 Input: You will be provided a list of fx rates, a selected currency, and a target currency. For example: FX rates list: USD to JPY 1 to 109 USD to GBP 1 to 0.71 GBP to JPY 1 to 155 Original currency: USD Target currency : JPY Output: Calculated the max target currency will can get. For example: USD to JPY -> 109 USD to GBP to JPY = 0.71 * 155 = 110.05 > 109, so the max value will be 110.05 Test 1 Test Input 0 USD, CAD,1.3;USD, GBP,0.71;USD, JPY, 109;GBP, JPY, 155 USD JPY Expected Output 110.05 Test 2 Test Input USD, GBP, 0.7;USD, JPY, 109;GBP, JPY,155;CAD, CNY, 5.27;CAD, KRW, 921 USD CNY Expected Output -1.0 1 import java.io.BufferedReader; 2 import java.io.IOException; 3 import java.io.InputStreamReader; 4 import java.nio.charset.StandardCharsets; 5 6 /** 7 * The Main class implements an application that reads lines from the standard input 8 * and prints them to the standard output. 9 */ 10 public class Main { 11 12 * Iterate through each line of input. 13 */ 14 public static void main(String[] args) throws IOException { 15 InputStreamReader reader = new InputStreamReader (System.in, StandardCharsets.UTF_8); 16 BufferedReader in = new BufferedReader (reader); 17 String line; 18 while ((line in.readLine( ) ) != null) { 19 System.out.println(line); 20 } 21 } /** IL 1. = 22 } 23

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

Database Programming With Visual Basic .NET

Authors: Carsten Thomsen

2nd Edition

1590590325, 978-1590590324

More Books

Students also viewed these Databases questions

Question

600 lb 20 0.5 ft 30 30 5 ft

Answered: 1 week ago

Question

2. What efforts are countries making to reverse the brain drain?

Answered: 1 week ago