Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You need to create a program that reads the input file (items.txt), and store the items in the file in the Item array. After creating

You need to create a program that reads the input file (items.txt), and store the items in the file in the Item array. After creating that array, send the output to a new file ex1out1.txt

1) Construct the class named Item which will represent the record in item.txt and have it stored as a seperate file called Item.java. Class will contain

a) constructor that accepts item number and item name

b) setters and getters for them

c) toString() to print the values

Main program:

1)Name it "Main" and have it call the method step1 that contains the following:

a) reserve an array of size 10 for Item objects. call it itemArray.

b) Read "items.txt" file and store the records in the itemArray.

c) Write name and a blank line to an output file called "ex1out1.txt" and then the array in the reverse order like the following:

FirstName LastName

105 Hammer Large

104 Hammer Small

103 Nail #3

102 Nail #2

101 Nail #1

d) Now, add an ArrayList of Item class and name it itemArrayList.

e) In addition to reading "items.txt" file into itemArray, have records stored in the itemArrayList as well.

f) Now, print the contents of "itemArrayList" in order ( number-wise) to "ex1out1.txt" below the output of "itemArray"

Files:

items.txt:

101,Nail #1 102,Nail #2 103,Nail #3 104,Hammer Small 105,Hammer Large 

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

Business Process Driven Database Design With Oracle PL SQL

Authors: Rajeev Kaula

1st Edition

1795532386, 978-1795532389

More Books

Students also viewed these Databases questions

Question

What are the HRM implications of this type of merger?

Answered: 1 week ago

Question

what are the provisions in the absence of Partnership Deed?

Answered: 1 week ago

Question

1. What is called precipitation?

Answered: 1 week ago

Question

1.what is dew ?

Answered: 1 week ago