Question: [1 8) Reading from a file: Assume there is a file named catalog.txt listing items for sale. Each line in the file is a comma-separated

[1 8) Reading from a file: Assume there is a file named catalog.txt listing items for sale. Each line in the file is a comma-separated list consisting of the item's name, the item's id number (an integer), and the item's price. For example, the first two lines in the file might look like the following: alarm clock,21359,29.95 hammer,01555628,14.30 Write a Java method called listItems that takes the name of the file as a parameter, reads from the file, and prints out the items one per line with: a) the id number followed by b) the name followed by c) the price with a leading dollar sign (S). For example, the above might be printed as follows: 21359 01555628 hammer alarm clock $29.95 $14.30 Bonus: print out the lines so the columns line up as shown above
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
