Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Define a class to represent a Customer object. A customer should consist of a first name and last name and a customer ID number (represented

Define a class to represent a Customer object. A customer should consist of a first name and last name and a customer ID number (represented as strings).

In the main, you will first declare an array of Customers and populate it with values from the customer.txt data. Use a try/catch block to catch the possible FileNotFoundException (or IOException) In case of such an exception, display an error message, and terminate the program early.

The format of the file is as follows:

  • The first line of the file includes an integer value that represents the number of customers included in the file. Your program should read this value and use it to create the array.
  • After the first line, each customers data is stored on three lines, containing the first name, then the last name, then the customer ID number.

After you have populated the array with the data from the file, you will enter the main program loop, and provide the user with four options:

  • List all Customers
  • Sort by Customer ID
  • Search by Customer ID
  • Exit

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

Students also viewed these Databases questions