Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A file named customers.txt contains the names of customers for a local hairdressing salon. Unfortunately, the data in the file is in no particular order

A file named customers.txt contains the names of customers for a local hairdressing salon. Unfortunately, the data in the file is in no particular order yet the owner of the salon would like the data in alphabetical order.

Code a Java program that reads the contents of the file into an array of Strings, sorts the array of Strings into alp habetical order, and then writes the content of the array to a file named sortedCustomers.txt. customers.txt contains one name per line and may contain data similar to:

Smith, Alexandra

Downes, Trish

Akbal, Maria

Note the following:

You cannot assume how many lines of text are in the file.

You cannot assume that the file exists.

When storing the names in the array you may assume an array size of 500 elements.

When coding the names to the sortedCustomer.txt file there should be one name per line. For example: Akbal, Maria Downes, Trish Smith, Alexandra

Your code must use appropriate methods with parameter passing to solve the question.

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

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions

Question

The buyer decision process for new products

Answered: 1 week ago

Question

Which is the largest fresh water leak in the world?

Answered: 1 week ago

Question

Which north american country known as the sugar bowl of the world?

Answered: 1 week ago

Question

South America is the continent located in which hemisphere?

Answered: 1 week ago

Question

Which of the following connects the south america to north america?

Answered: 1 week ago