Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need solutions to murach's java programming 4th Edition. Specifically Exercise 18-1 Exercise 18-1 Work with a text file In this exercise, you'll add code

I need solutions to murach's java programming 4th Edition. Specifically Exercise 18-1

image text in transcribedimage text in transcribed

Exercise 18-1 Work with a text file In this exercise, you'll add code to a Customer Maintenance application for reading and writing data from a text file named customers.txt. Each record in this file contains three fields with the customer's first name, last name, and email. The fields are separated by a tab character, and the records are separated by a new line character. Open the application and review its code 1. Open the project named ch18_exl_CustomerMaint that's in the ex_starts directory 2. Open the Customer class and review its code. 3. Open the CustomerTextFile class, and notice the three class variables that will store the array list of Customer objects, a Path object for the file, and a File object for the file. Add code to the constructor that initializes these variables. Add code to the getCustomers method that loads the array list variable with the Customer objects that are created from the data in the customers.txt file. Be sure to check that this file exists, and if it does, use a try-with-resources statement to open the input stream. If an IOException occurs when the input stream is opened, print the exception to the console and return a null to the calling method. Add code to the saveCustomers method that writes the data in each Customer object in the array list to a record in the customers file. Be sure to delimit the fields and records with the appropriate character. If an IOException is thrown 4. 5

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

Advanced Oracle Solaris 11 System Administration

Authors: Bill Calkins

1st Edition

0133007170, 9780133007176

Students also viewed these Databases questions