Question: Exercise 3 - Formatted output to a file. Write a program Price.java that reads in a list of prices (separated by a space) from the

 Exercise 3 - Formatted output to a file. Write a program

Exercise 3 - Formatted output to a file. Write a program Price.java that reads in a list of prices (separated by a space) from the file prices.txt and prints a formatted table consisting of three columns as shown below into a file called formattedresults.txt. The first column consists of the prices as read from prices.txt (in US dollars). The second column prints a discounted price that represents a 1/3 discount on the price. The third column prints the equivalent value of the discounted price in Lebanese Liras rounded to the nearest LL 50. Your output should have 2 digits after the decimal in the first 2 columns and no decimal in the third. It should also print column headers and makes sure the columns are lined up properly. Your program should prompt the user the enter the exchange rate from US dollars to Lebanese pound. Intermediate Programming with Data Structures (CMPS 212) For example, if the exchange rate is ($1 = LL 1508) and the prices.txt contains 80 and 140, then an invocation of your program might produce the below output stored in formattedresults.txt: Original Price (in $) Discounted Equivalent Price (in LL) $ 80.00 $53.33 LL 80450 $140.00 $93.33 LL 140750

Step by Step Solution

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 Databases Questions!