Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Description: In designing interactive application like shopping activities, it is desirable to have the test data stored in a file to speed up the testing

Description: In designing interactive application like shopping activities, it is desirable to have the test data stored in a file to speed up the testing time. So, to prepare for the future project, we need to get used to file I/O in Java.

There is a tab-delimited text file named p1artists.txt which is to be used as an input file. Each record consists of the following two fields:

a. artistID: integer. b. artistName: String;

Implement the Artistclass that contains the following:

1.The 2 fields mentioned above in p1artists.txt file

2. The Constructor that accepts the 2 fields when the record of an artist is created.

3. Getters and setters for the 2 fields

4. The toString() method.

5. Test the program with the following data hardcoded inside the program.

ArtistID Artist Name 1 Acconci 2 Ames 3 Aserty 4 Baron 5 Battenberg

ii. Modify the above program according to the following:

1. Read the input file p1artists.txt.

2. Use the exception handler to ensure that the file is indeed available and ArtistID is numerical.

3. If the input is incorrect, print the line number and its contents, but do not stop

4. Send the output to a text file named p1artists_out1.txt.

iii. Enhance the above program for the following:

1. A tab-delimited text file named p1arts.txt contains the following fields:

ArtID Title ArtistID Appraised Value 1001 Red Rock Mountain 50 18000 1002 Offerings 52 10000 1003 Spring Flowers 12 2400

2. Assume that this file contains no error. You are going to read p1artists.txt into an array, and then process p1arts.txt to add the artist name to the output. Name this output file p1arts_out.txt. Example follows:

ArtID Title Artist ArtistID Appraised Value 1001 Red Rock Mountain Mogan 50 18000 1002 Offerings Novarre 52 10000 1003 Spring Flowers Chico 12 2400

3. In the end, include the total number of the Art Works and Artists, and the total appraised value

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_2

Step: 3

blur-text-image_3

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

Handbook Of Relational Database Design

Authors: Candace C. Fleming, Barbara Von Halle

1st Edition

0201114348, 978-0201114348

More Books

Students also viewed these Databases questions

Question

How are members held accountable for serving in the assigned roles?

Answered: 1 week ago

Question

Have roles been defined and assigned?

Answered: 1 week ago