Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Choose five international source currencies to monitor. Each currency is referenced with a three letter ISO 4217 currency code. For example, the code for the

Choose five international source currencies to monitor. Each currency is referenced with a three letter ISO 4217 currency code. For example, the code for the British Pounds is GBP. Search online for these abbreviations with a search string such as \"ISO 4217 Currency Codes.\"

Place these currency codes in a text files named currency.txt. Do not include USD as one of the currency symbols if you are using USD as the base currency The following URL is a link to a CSV file that contains the exchange rate for a given source and target currency.

For example, if the source currency is EUR and the target currency is USD, the URL is

https://api.fixer.io/latest?base=USD&symbols=GBP

and the returned JSON string is {\"base\":\"USD\",\"date\":\"2018-02-01\",\"rates\":{\"GBP\":0.70246}}

To obtain all of the available currencies returned by this website, omit the symbols argument: https://api.fixer.io/latest?base=USD Use try..catch blocks to handle all exceptions with a user-friendly message in the catch block. Do not throw any exceptions.

In a while loop that terminates when the end of file is reached, do the following: Read the next currency from the currencies.txt file. Create a URL for the api.fixer.io site that will obtain a URL for obtaining the exchange rate using the currency read in Step 1 as the target currency (symbol) and USD as the source currency (base).

Using the URL from Step 2, create a scanner object that reads the JSON string from the website. Extract the exchange rate from the JSON string. Add a bar to a JFreeChart bar chart, whose height is the exchange rate from Step 3. Identify the source code items that belong before, in, and after the while loop.

Don't forget to close each scanner when you are finished using it. Your project should contain only a single class, which contains the main method. This class must define at least three additional static methods that modularize the tasks in this project. For example, you might define methods such as these: public static String getCurrency(Scanner s) public static String getUrlString(String targetCurrency) public static double getExchangeRate(String urlString) If you wish, use the Eclipse Refactor capability to extract the methods.

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

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions

Question

11. When should you use podcasts?

Answered: 1 week ago