Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

T 2045C Computer Programming II Prof. Tom Wulf Fall 2021-22 Practicum 01 Java File IO and Safe Input review 20 points Learning Goals: Review Java

T 2045C Computer Programming II Prof. Tom Wulf Fall 2021-22 Practicum 01 Java File IO and Safe Input review 20 points Learning Goals: Review Java text file IO o Be able to write programs that read and write java text files Review the SafeInput library we developed in CP I. All our console programs will use this library Write two suites of programs each with a reader and writer to create and read data files Be sure to retain a copy of this and all work for the course. You will need these programs and files later as we work through the labs. Note: we are switching to the IntelliJ editor this time. It will be used in future java courses so you should use it. If you see a reference to Netbeans use IntelliJ instead. Directions: Create a IntelliJ project using the filenames specified for both parts. Do not create java packages here. Use the default package. That rule is for all assigned work! Part 1: Person Project Name: Person Model Files: PersonGenerator.java, PersonReader.java, SafeInput.java Note: include and use SafeInput.java in both of these projects. (Be sure to place a separate copy within each of the project folders.) The SafeInput.java source file is available with the assignment directions in Bb, just download and include it in each project. Keep a copy handy with your work for use throughout the course. (We will review in class during the first week how to use SafeInput.)

1. Create a program (java main class) called PersonGenerator.java. 2. Your program will prompt the user to enter lines of data for a file on persons. You dont know ahead of time how many Persons will be entered so use an ArrayList to store the records. 3. Once the user indicates they have entered all the data elements for each person save it to a text file using a name they provided. (Be sure to only save complete sets of elements.) 4. Be sure to use the SafeInput library to completely bullet-proof your program. Block and repeat until the user gets the input correct. Do not terminate. INSERT SEVERAL SCREEN SHOTS SHOWING THE INPUT OF THE DATA. BE SURE TO GET ONE OF A COMPLETE RECORD. 5. Here is the data and file format. One record per line. Each line has all of the data elements (a e) a. ID (a String) b. FirstName c. LastName d. Title (a string like Mr., Mrs., Ms., Dr., etc.) e. YearOfBirth (an int) 6. These files contain no headers. There is one person record per line in the comma- delimited format. Here is a sample record: 000001, Bilbo, Baggins, Esq., 1060 7. Be sure to test your program carefully. Use your program to create a data file called PersonTestData.txt with these records: 000001, Bilbo, Baggins, Esq., 1060 000002, Frodo, Baggins, Esq., 1120 000003, Samwise, Gamgee, Esq., 1125 000004, Peregrin, Took, Esq., 1126 000005, Meridoc, Brandybuck, Esq., 1126 8. Leave a copy of the data file in the project folder, Please remove other test files. DISPLAY A SCREEN SHOT OF THIS FILE IN THE IntelliJ EDITOR HERE! Part 2: PersonReader.java 1. Now create a new java main class in the same project called PersonReader.java. 2. Be sure to use JFileChooser and SafeInput.

3. Create a program that prompts the user to select an existing Person file and then displays the file to the screen. 4. Use your PersonTestData.txt file to test and debug your program. Use String.format to create a neatly formatted columnar display of the data records ID# Firstname Lastname Title YOB ===================================== 000001 Bilbo Baggins Esq. 1060 02 Frodo Baggins Esq. 1120 ... GET SCREENSHOTS OF: - THE FILECHOOSER RUNNING

USED ON INTELI JAVA I NEED THE FULL CODE PLEASE HELP

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

Refactoring Databases Evolutionary Database Design

Authors: Scott Ambler, Pramod Sadalage

1st Edition

0321774515, 978-0321774514

More Books

Students also viewed these Databases questions