DAT/210 Week 3 Java LAB 4.17: Data File

$ 7

DAT/210 Week 3 Java LAB 4.17: Data File

A comma separated value (.csv) file has been included to be used for this program. Each line contains two values, a name and a number separated by a comma (except the first line, which contains the titles for the value types). The name is that of a writer and the number refers to the number of works the writer has written. Ex. Jane Austen,6. Each line is an entry and each entry number can be updated by identifying the associated name.

Once complete, the following program opens data file allWorks.csv and asks if the user wants to update entries or add new entries. All entries are stored in an array while being read in and updated. The program then writes the array to the file, overwriting the original contents. The following TODO sections must be completed.
• Open allWorks.csv for reading/input.
• Locate an entry to be updated by name (use the Java String index0f() method)
• Add a new entry if the name isn’t found in the file (give the entry a new number)
• Open file allWorks.csv for output
• Write contents of the array to allWorks.csv (original file is overwritten)

Ex If the input is:
y
J.K. Rowling
30
y
Elton John
y
62
n
and allWorks.csv originally contains:
Name,Number of Novels
Jane Austen,6
Charles Dickens,20
Ernest Hemingway,9
Jack Kerouac,22
F. Scott Fitzgerald,8
Mary Shelley,7
Charlotte Bronte,5
Mark Twain,11
Agatha Christie,73
Ian Flemming,14
J.K. Rowling,14
Stephen King,54
Oscar Wilde,l

the output in all Works.csv is:
Name,Number of Novels
Jane Austen,6
Charles Dickens,20
Ernest Hemingway, 9
Jack Kerouac,22
F. Scott Fitzgerald,8
Mary Shelley,7
Charlotte Bronte,5
Mark Twain,11
Agatha Christie,73
Ian Flemming,14
J.K. Rowling,30
Stephen King,54
Oscar Wilde,l
Elton John,62

910 in stock

SKU: DAT210WK3LAB4P17 Category:

Description

DAT/210 Week 3 Java LAB 4.17: Data File

A comma separated value (.csv) file has been included to be used for this program. Each line contains two values, a name and a number separated by a comma (except the first line, which contains the titles for the value types). The name is that of a writer and the number refers to the number of works the writer has written. Ex. Jane Austen,6. Each line is an entry and each entry number can be updated by identifying the associated name.

Once complete, the following program opens data file allWorks.csv and asks if the user wants to update entries or add new entries. All entries are stored in an array while being read in and updated. The program then writes the array to the file, overwriting the original contents. The following TODO sections must be completed.
• Open allWorks.csv for reading/input.
• Locate an entry to be updated by name (use the Java String index0f() method)
• Add a new entry if the name isn’t found in the file (give the entry a new number)
• Open file allWorks.csv for output
• Write contents of the array to allWorks.csv (original file is overwritten)

Ex If the input is:
y
J.K. Rowling
30
y
Elton John
y
62
n
and allWorks.csv originally contains:
Name,Number of Novels
Jane Austen,6
Charles Dickens,20
Ernest Hemingway,9
Jack Kerouac,22
F. Scott Fitzgerald,8
Mary Shelley,7
Charlotte Bronte,5
Mark Twain,11
Agatha Christie,73
Ian Flemming,14
J.K. Rowling,14
Stephen King,54
Oscar Wilde,l

the output in all Works.csv is:
Name,Number of Novels
Jane Austen,6
Charles Dickens,20
Ernest Hemingway, 9
Jack Kerouac,22
F. Scott Fitzgerald,8
Mary Shelley,7
Charlotte Bronte,5
Mark Twain,11
Agatha Christie,73
Ian Flemming,14
J.K. Rowling,30
Stephen King,54
Oscar Wilde,l
Elton John,62

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.