Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3rd time posting. Please help. Basic JavaFX. Problem Statement: An extract of some names and personal information has been made from a baseball database. This

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed3rd time posting. Please help. Basic JavaFX.

Problem Statement: An extract of some names and personal information has been made from a baseball database. This assignment is to read the data from a comma separated value text file (CSV), write the data into a binary file, then read it back in, writing the data to the screen showing that the data in the binary file is intact and correct. You must implement the following GUI: 375 x 400 Baseball - D. Patric File: Open Records in: Records Out: btnOpen tfFileName tfRecordsOut tfRecordsin taData: Font MONOSPACED, 12 point When the user clicks the Open button, display a FileChooser that shows CSV files in the current directory and let the user choose one. You will create a similarly named .dat file. Example: Given filename BaseballNames2.csv, the output file is named BaseballNames2.dat. Input Datafile layout: Two CSV datafiles have been provided for testing, BaseballNames1.csv and BaseballNames2.csv. Each contains a header line as the first line of the file. A blank line may or may not follow. Your program must account for either a blank or non-blank line (record) regardless of what the sample file shows. The program must also account for leading and trailing spaces or tabs in the data (see the String method trim for help with this), along with various errors. The file layout is as follows: Field name First Name Last Name Birth Day Birth Month Birth Year Weight Height Data type Text Text Whole number Whole number 4-digit year Whole number Number with decimal part File BaseballNames1.csv contains no errors, and your program must be able to process this one cleanly before you move to the next datafile. File BaseballNames2.csv may have a value for each expected field or may not. Since this was a database extract, some missing (null) fields show up in the data. Some records may have one or more missing fields. Write errors to the taData text area and only valid records to the .dat file. When an error is encountered in a line read in from the CSV, write the line and first error found to taData. Then continue to process the rest of the file. Your program will then read your created *.dat data file and print it to taData. Reporting multiple errors per record is a bonus, described below. Correctly writing the above with Javadocs, can gain you full credit for this homework. My Solution Together with the two csv files, the Downloads for HW02 include a jar file for my solution called BaseballA.jar. You can run this to see how your program should run. The bonuses are not provided in this solution. The program BaseballB.jar is my solution with the bonus levels (both of them) in place. Output datafile layout: The binary output (.dat) file must have the fields in the same order as the input. No headings are written in the output file, only the data. The appropriate binary 1/0 data types must be used, text must be written as text, numbers must be written as the appropriate numeric data type. You must use the appropriate methods of DatalnputStream and DataOutputStream for all 1/0 to the ".dat" file. Output report: At the end of reading the csv file, and writing the dat file, display how many records were read from the csv file in tfRecordsin and how many records were written to the dat file in tfRecordsOut. Remember to count the heading and blank lines as records read in, but not written out. Similarly, records with errors are records read in but not written out. Use formatted printing, so the output report looks impressive. Spacing does not have to be exactly as shown, but it should be close. Hints: Dates are provided in the western format of "month, day, year". I suggest getting BaseballNames1.csv to work first. Save a backup copy of the code, then start on BaseballNames2.csv. Make sure you hand in something before the due date. Any bonus points won't make up for the late deductions. Submission Submit to the HW02 Assignment folder your best version of the file processing. DO NOT submit more than one version, as the wrong one may be graded, lowering your grade. This homework is due into the Assignment folder by the date/time shown on the folder. Sample outputs: BaseballNames1.csv - no errors. Use this for initial testing only. Open Baseball - D. Patric File: BaseballNamesi.csv Records In: 22 Records Out: 20 First Last name Birthdate Weight Height Starlin Castro Madison Bumgarner Jason Heyward Ruben Tejada Jenrry Mejia Mike Stanton Dayan Vicedo Chris Sale Freddie Freeman Clayton Kershaw Travis Snider Elvis Andrus Trevor Cahill 3/24/1990 8/1/1989 8/9/1989 10/27/1989 10/11/1989 11/8/1989 3/10/1989 3/30/1989 9/12/1989 3/19/1988 2/2/1988 8/26/1988 3/1/1988 199 215 240 160 160 235 240 170 225 225 235 200 220 72.8 76.0 77.3 71.2 72.5 77.9 71.1 77.2 77.7 75.4 72.0 72.0 76.0 There are more lines than are shown here, as indicated by the vertical scrollbar. Single error reported per record (BaseballNames2.csv). Open 4 Baseball - D. Patric File:BaseballNames2.csv Records In: 16 Records Out: Offending item is: Height Error found in: Gerardo Parea offending item is: Weight Error found in Mat Lates offending item is: Birth day .6, 5, 1987 null, nul First 6 Last name Birthdate Weight Height Ryan Kalish Cameron Maybin Sean O'Sullivan Joah Reddiek 3/28/1988 4/4/1987 9/1/1997 2/19/1987 205 210 230 180 73.0 75.0 74.0 74.0 Multiple errors reported per record (BaseballNames3.csv) and record with insufficient fields. Baseball - D. Patric BasebalNames3.csv Open Records In: 20 Records Out: 2 Bruce Error found in: Jay 2, null, Offending data: Error found in: Shairon Martia . 30, 3, 198 Offending data: Error found in Ryan Not enough fields in the record Error found in: Gerardo * Parra null, mul Offending data: Error found in: Sean O'Sullivan Offending data: Error found in: Mat Lates 9, 12 Offending data: Error found in: Josh Reddick null, Offending data: First 6 Last name Birthdate Weight Height Ryan Kalish Conor Gillaspie 3/28/1988 7/18/1987 205 200 73.2 73.3 Beginning output is omitted to show end result. Problem Statement: An extract of some names and personal information has been made from a baseball database. This assignment is to read the data from a comma separated value text file (CSV), write the data into a binary file, then read it back in, writing the data to the screen showing that the data in the binary file is intact and correct. You must implement the following GUI: 375 x 400 Baseball - D. Patric File: Open Records in: Records Out: btnOpen tfFileName tfRecordsOut tfRecordsin taData: Font MONOSPACED, 12 point When the user clicks the Open button, display a FileChooser that shows CSV files in the current directory and let the user choose one. You will create a similarly named .dat file. Example: Given filename BaseballNames2.csv, the output file is named BaseballNames2.dat. Input Datafile layout: Two CSV datafiles have been provided for testing, BaseballNames1.csv and BaseballNames2.csv. Each contains a header line as the first line of the file. A blank line may or may not follow. Your program must account for either a blank or non-blank line (record) regardless of what the sample file shows. The program must also account for leading and trailing spaces or tabs in the data (see the String method trim for help with this), along with various errors. The file layout is as follows: Field name First Name Last Name Birth Day Birth Month Birth Year Weight Height Data type Text Text Whole number Whole number 4-digit year Whole number Number with decimal part File BaseballNames1.csv contains no errors, and your program must be able to process this one cleanly before you move to the next datafile. File BaseballNames2.csv may have a value for each expected field or may not. Since this was a database extract, some missing (null) fields show up in the data. Some records may have one or more missing fields. Write errors to the taData text area and only valid records to the .dat file. When an error is encountered in a line read in from the CSV, write the line and first error found to taData. Then continue to process the rest of the file. Your program will then read your created *.dat data file and print it to taData. Reporting multiple errors per record is a bonus, described below. Correctly writing the above with Javadocs, can gain you full credit for this homework. My Solution Together with the two csv files, the Downloads for HW02 include a jar file for my solution called BaseballA.jar. You can run this to see how your program should run. The bonuses are not provided in this solution. The program BaseballB.jar is my solution with the bonus levels (both of them) in place. Output datafile layout: The binary output (.dat) file must have the fields in the same order as the input. No headings are written in the output file, only the data. The appropriate binary 1/0 data types must be used, text must be written as text, numbers must be written as the appropriate numeric data type. You must use the appropriate methods of DatalnputStream and DataOutputStream for all 1/0 to the ".dat" file. Output report: At the end of reading the csv file, and writing the dat file, display how many records were read from the csv file in tfRecordsin and how many records were written to the dat file in tfRecordsOut. Remember to count the heading and blank lines as records read in, but not written out. Similarly, records with errors are records read in but not written out. Use formatted printing, so the output report looks impressive. Spacing does not have to be exactly as shown, but it should be close. Hints: Dates are provided in the western format of "month, day, year". I suggest getting BaseballNames1.csv to work first. Save a backup copy of the code, then start on BaseballNames2.csv. Make sure you hand in something before the due date. Any bonus points won't make up for the late deductions. Submission Submit to the HW02 Assignment folder your best version of the file processing. DO NOT submit more than one version, as the wrong one may be graded, lowering your grade. This homework is due into the Assignment folder by the date/time shown on the folder. Sample outputs: BaseballNames1.csv - no errors. Use this for initial testing only. Open Baseball - D. Patric File: BaseballNamesi.csv Records In: 22 Records Out: 20 First Last name Birthdate Weight Height Starlin Castro Madison Bumgarner Jason Heyward Ruben Tejada Jenrry Mejia Mike Stanton Dayan Vicedo Chris Sale Freddie Freeman Clayton Kershaw Travis Snider Elvis Andrus Trevor Cahill 3/24/1990 8/1/1989 8/9/1989 10/27/1989 10/11/1989 11/8/1989 3/10/1989 3/30/1989 9/12/1989 3/19/1988 2/2/1988 8/26/1988 3/1/1988 199 215 240 160 160 235 240 170 225 225 235 200 220 72.8 76.0 77.3 71.2 72.5 77.9 71.1 77.2 77.7 75.4 72.0 72.0 76.0 There are more lines than are shown here, as indicated by the vertical scrollbar. Single error reported per record (BaseballNames2.csv). Open 4 Baseball - D. Patric File:BaseballNames2.csv Records In: 16 Records Out: Offending item is: Height Error found in: Gerardo Parea offending item is: Weight Error found in Mat Lates offending item is: Birth day .6, 5, 1987 null, nul First 6 Last name Birthdate Weight Height Ryan Kalish Cameron Maybin Sean O'Sullivan Joah Reddiek 3/28/1988 4/4/1987 9/1/1997 2/19/1987 205 210 230 180 73.0 75.0 74.0 74.0 Multiple errors reported per record (BaseballNames3.csv) and record with insufficient fields. Baseball - D. Patric BasebalNames3.csv Open Records In: 20 Records Out: 2 Bruce Error found in: Jay 2, null, Offending data: Error found in: Shairon Martia . 30, 3, 198 Offending data: Error found in Ryan Not enough fields in the record Error found in: Gerardo * Parra null, mul Offending data: Error found in: Sean O'Sullivan Offending data: Error found in: Mat Lates 9, 12 Offending data: Error found in: Josh Reddick null, Offending data: First 6 Last name Birthdate Weight Height Ryan Kalish Conor Gillaspie 3/28/1988 7/18/1987 205 200 73.2 73.3 Beginning output is omitted to show end result

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

Database Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

Students also viewed these Databases questions

Question

Explain the key areas in which service employees need training.

Answered: 1 week ago

Question

How do modern Dashboards differ from earlier implementations?

Answered: 1 week ago