Question
*********** Java Programming through eclipse. Design work need to be obvious. You are to write a program to be used at a currency exchange. The
*********** Java Programming through eclipse. Design work need to be obvious.
You are to write a program to be used at a currency exchange. The exchange converts to and from:
US Dollars
Euros
Yen
Yuan
British Pounds
Each transaction is charged a %5 percent exchange fee.
Your code should:
1.Input the currency they have using a menu
2.Input the amount of that currency they wish to exchange
a.Use a method that uses a try-catch
3.Input the currency they wish to exchange to
4.Calculate the fee and deduct from the original amount
5.Convert the deducted amount to the new currency
6.Output (with labels):
a.The original amount
b.The fee
c.The amount received
Allow this to be repeated as the user wishes
Current exchange rates:
1 US Dollar -> 0.842815 Euros
1 US Dollar -> 111.779407 Yen
1 US Dollar -> 6.609776 Yuan
1 US Dollar -> 0.744047 Pounds
Requirements:
Use a generic menu and conversion method
o Your conversion method will convert to dollars, and then to the desired currency
Use declared constants for the four exchange rates, and the fee rate (5%)
o No exchange rate needed for dollars
Output rounded to 2 decimals
You should do the usual design work, including test data, but no need to turn it in.
Add the following summary data:
The number of exchanges
o Do not count the times they entered the same currency
The change in value for each currency
o Start all 5 accumulators out at 0.0
o Add the total amount of the currency received to the proper accumulator
o Subtract the amount of currency given out to the proper accumulator
o Some accumulators may end up negative
o Example: 100 dollars is received. The fee would be 5, so 95 dollars is exchanged to 70.68 pounds
The dollar accumulator is increased 100, the pound decreased 70.68
Suggestions:
You will end up with 5 cases in the outside switch, and 5 in each of those cases. Check your work thoroughly to be sure you have it all working well.
o One case in each will be: "Same currency, no exchange done" if they choose to convert to the same currency they have.
Start with three currencies and get it to work. Then add the forth and test. Then add the fifth and test.
You may find the following handy
o A method that takes a single char as a parameter and returns a string
Send it A through E, and it returns the name of the currency
o A single output method
Send it the two chars (A through E) that represent the currencies, the original amount, the fee, and the resultant currency amount
Saves having to write 20 different output sections
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started