Lab01 Java Program Solved

30.00 $ 15.00 $

Category:

Description

Write a Java program named CurrencyConverter that will convert bitcoin into U.S. dollars. Your code will include declarations for several variables, prompting the user, accepting user input, storing user input in variables, calculating a result, and outputting results to the console.

Requirements

1.Declare a Scanner object to accept keyboard input.

2.Declare variables, as needed, for:

a.Loop control

b.Holding user input data

c.Holding the results of the necessary calculation(s)

d.Other variables as you may see necessary

3.Use a while loop for continuous processing. Continuation of the loop will depend on user response to a prompt asking whether to continue or not.

4.Within the loop structure:

a.Prompt the user for the number of bitcoins to convert; accept and store the user input

b.Prompt the user for the exchange rate; accept and store the user input

c.Calculate the exchange value in U.S. dollars based on the number of bitcoins to exchange and the exchange rate

d.Output to the user:

i.The number of bitcoins to exchange

ii.The exchange rate used

iii.The number of U.S. dollars to be exchanged for the bitcoins

e.Prompt the user regarding continuing to calculate exchanges

Expected Output

Your output need not be identical to that shown here, but you MUST correctly format the U.S. dollar amount in the output (highlighted portions of output). User input appears in bold-faced, blue type.

How many bitcoins are you exchanging?

3.248

What is the current exchange rate?

1152.953.25

bitCoins at an exchange rate of 1152.950000 yields $3,744.78 USD.

Do you wish to calculate another exchange? Yes or No.

Yes

How many bitcoins are you exchanging?

113.558

What is the current exchange rate?

1000

113.56 bitCoins at an exchange rate of 1000.000000 yields $113,558.00 USD.

Do you wish to calculate another exchange? Yes or No.

No

Goodbye!