Chapter 5: Goodies Lesson 5

Website (Links to an external site.)

Reading from the data file can be part of the Final Implementation. At this stage, it is more important that you implement the Business aspect of the application.

a. Start your application by reading the raw data from the data.txt file to the content array.

b. Display the raw data line by line.

c. Display the content of the array in well-aligned rows and columns 

Chips               45   25   0.75

Popcorn          45   22   0.75

Pop Corners    45   22   0.75

…

The data in this file is as follows:
The name of the item, the available quantity, the cost per case of 45, and the sale price of the item.

d. Select the “Business” 

e. Select the “Inventory” 

data.txt  Download data.txt 

Required Submission

Copy and paste the terminal activity including the display of the raw data and array content in the Text Entry. A grade of zero will be given if this item is not in the Text Entry tab.

  • Include documentation in any file you create.
  • Your files do not need to have your initials. Only the zip file requires the name of the project with your initials.
  • Your static main method can not be a method in the ADT. You need to create a tester/driver class.

Header:

  • Assignment description ( you can copy and paste the assignment itself)
  • All authors’ names and the business name.
  • Language and version
  • Date of completion

Help with formatting printing:

printfexample.png
printftable.png

If you have to print multiple fields, here is an example:

System.out.printf(“%8.3f%10s”, Math.PI,”Hello”);

Output:

   3.142     Hello