Java Code Program Paper Follow the description Follow the description Follow the description Follow the description Write a program CurrencyConverter.
Java Code Program Paper Follow the description
Follow the description
Follow the description
Follow the description Write a program CurrencyConverter.java (in a package named a02) that takes currency amounts in Euros (EUR), US Dollars (USD) and
Japanese Yen (JPY) as command line arguments and converts them to canadian dollars (CAD).
The correct format for the command line arguments will be at least one digit (possibly more) followed by a folowed by exactly
digits followed by a 3 character currency code (ignoring upper or lower case).
Some examples of valid arguments are:
0.34USD
30.00eur
55768.34jPY
Some examples of invalid arguments are:
.34USD
30EUR
5768.931JPY
Your program will need to check if the arguments are valid and it should not crash if they are not valid.
Hints:
The min length of a valid input is 7
A valid input must end with one of the 3 character codes
The 3 characters before that must be then two digits
All the characters before that, no matter how many there are need to be digits
The program should have 2 modes of operation:
1) If no command line arguments are given the program should display the normal
information header as well as instructions for the user on the correct usage of
the program (how command line arguments should be formatted to be valid).
The program should then pause before ending.
Example with no command line parameters:
Example with no command line parameters
Assignment
Lastname, Firstname
A#*****
Description of the program
Including instructions for use
Press enter to end.
2) If one or more command line argument(s) is provided the program will not display the information header and will output the
converted amounts one per line. If any of the inputs are invalid then the corresponding line will display an error message but the
program will continue with converting the next argument until all have been converted. The program should then pause before
ending
Example with command line arguments: 12.50EUR 125.00USD 13EUR 15.67USD 50000.00JPY 1.00JPY
€12.50 EUR is $19.00 CAD
$125.00 USD is $161.25 CAD.
Error: invalid input 13EUR.
$15.67 USD is $20.21 CAD.
¥50000.00 JPY is $550.00 CAD.
¥1.00 JPY is $0.01 CAD.
Press enter to end..
Notice the format of the output, both the input amount and the converted amount are displayed with the correct currency symbol
and exactly 2 places after the decimal point. Also the values are rounded correctly to those 2 digits after the decimal point (printf will
do this rounding for you!).
The program should use the following exchange rates:
1 EUR is 1.52 CAD
1 USD is 1.29 CAD
1 JPY is 0.011 CAD
For this assignment you should use several methods (with Javadoc comments) rather than have all the code in the main method. For
example a method that checks if a parameter is valid, a method that converts the currency, a method that outputs the results in the
correct format, etc.
package lecture03;
import java.util.Scanner;
import primes. Primes;
@author Joshua
public class Lectures {
public static void main(String[] args) {
//kbd.nextInt();
Scanner kbd=new Scanner(System.in);
//get the input from the user
int num=Primes.getInput();
//determine if the number is prime
boolean is Prime=Primes.isItPrime (num);
//output the results to user
Primes.outputResults(num, isprime);
}
}
Purchase answer to see full
attachment
We've got everything to become your favourite writing service
Money back guarantee
Your money is safe. Even if we fail to satisfy your expectations, you can always request a refund and get your money back.
Confidentiality
We don’t share your private information with anyone. What happens on our website stays on our website.
Our service is legit
We provide you with a sample paper on the topic you need, and this kind of academic assistance is perfectly legitimate.
Get a plagiarism-free paper
We check every paper with our plagiarism-detection software, so you get a unique paper written for your particular purposes.
We can help with urgent tasks
Need a paper tomorrow? We can write it even while you’re sleeping. Place an order now and get your paper in 8 hours.
Pay a fair price
Our prices depend on urgency. If you want a cheap essay, place your order in advance. Our prices start from $11 per page.