Question: SR 3.26 Suppose that in your program you have a double variable named cost. You want to output the value stored in cost formatted

SR 3.26 Suppose that in your program you have a double variable

SR 3.26 Suppose that in your program you have a double variable named cost. You want to output the value stored in cost formatted as the currency of the current locale. a. Write a code statement that declares and requests a NumberFormat object named moneyFormat that can be used to represent currency in the format of the current locale. b. Write a code statement that uses the moneyFormat object and prints the value of cost, formatted as the currency of the current locale. c. What would be the output from the statement you wrote in part (b) if the value in cost is 54.89 and your computer's locale is set to the United States? What if your computer's locale is set to the United Kingdom?

Step by Step Solution

3.40 Rating (156 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Java Software Solutions Questions!