Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

your driver should read the data from a text file where each line in the input file represents one item and the line includes the

your driver should read the data from a text file where each line in
the input file represents one item and the line includes the following values separated by
tab: (1) a number (1,2, or 3) to specify whether the line represents an ItemA, ItemB, or
Item object respectively, (2) string value, (3) integer value, and (4) an integer value for
ItemA lines or boolean value for ItemB lines. Assume the input file is formatted correctly
and you do not have to check for lines that are not in the given format. This is an example
input file:
1 aaa 1020
2 bbb 20 true
3 ccc 39
2 aaa 10 false
3 aaa 10
1 ddd 4050
2- Create an input file of at least 20 lines with at least 5 lines for each item type
(Item/ItemA/ItemB). Include some duplicate lines to test that the add method does not
add duplicate items.
3- Write code to ask the user for the path of the data file, read the file name, open the file, read
the file line by line, and upload the data to an SortedSet.
4- Print the list. Make sure the items are in sorted order and there are no duplicates.
5- Include at least two test cases for each one of the following methods: indexOf, remove,
grab, and categorySet. Make sure to print appropriate messages in the output so
that it is easy to interpret your test cases
txt.file
Minnesota, 10000,55110
Kansas, 20000, false
Michigan, 19000
New York, 30000
Washington, 52000

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

Time Series Databases New Ways To Store And Access Data

Authors: Ted Dunning, Ellen Friedman

1st Edition

1491914726, 978-1491914724

More Books

Students also viewed these Databases questions