Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The file will be tested 3 times with different file sizes so I don't code the program to assume it has just the four lines

image text in transcribed

image text in transcribed

The file will be tested 3 times with different file sizes so I don't code the program to assume it has just the four lines from the sample order.txt file.

+ import java.io.Printwriter;0 5 Je /** 3 * This programs must: * 2 . 2 3 1 7 3 2 2 . 2 3 1. Read from order.txt and write to invoice.txt. 2. Write a header to the output file. 3. For each line of the input file: a. Read the quantity, price, and description. b. Compute the extension (quantity * price) c. Format and write these values to the output file using printf. d. Keep track of the running total. 4. After all lines have been processed, write the total to the file using printf. * Refer to AddLineNumbers.java and Reviews.java for pieces needed to develop this program. * Do not assume that the input file has a certain number of lines. Your program must * continue reading until the end of the input file is reached. * Before starting, look at invoice_example.txt to see how the invoice.txt file you are going * to create must be formatted. * The first time you run this program, invoice.txt is not going to appear automatically * in Eclipse. To see the file, right-click on the FileIo project and choose Refresh. */ 5 5 7 3 3 3 public class Invoice { public static void main(String[] args) throws IOException { // YOU MUST USE THESE EXACT FILENAMES! Do not change them or your program // will not run correctly for grading. String inputFileName = "order.txt"; String outputFileName "invoice.txt"; 5 = 1 The following lines show what your invoice.txt file should look like. 2 3 Oty Description Price Ext 4 5 Backpack $ 19.99 $ 99.95 5 10 Paper $0.99 $ 9.90 6 3 Pens $ 1.49 $ 4.47 7 2 Pencils $ 1.19 $ 2.38 8 9 Total: $ 116.70 10

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago