Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA PROGRAM (Please screenshot your output) SORT AND MERGE Write a program that performs the following tasks: Display a friendly greeting to the user Prompt

JAVA PROGRAM (Please screenshot your output) SORT AND MERGE

Write a program that performs the following tasks:

  • Display a friendly greeting to the user
  • Prompt the user for a file name (a list of numbers to be sorted)
  • Accept that file name
  • Prompt the user for a second file name (another list of numbers to be sorted)
  • Accept that file name
  • Open and read the data in the first file
  • Sort that data using an algorithm that you wrote yourself (notArray.sort)
    • One of the lists will be sufficiently large that a simple algorithm wont suffice
  • Open and read the data in the second file
  • Sort that data, again using your own algorithm
  • Merge the two sorted lists into a single sorted file (see Problem 7-31) using a linear algorithm.
  • Prompt the user for a file name
  • Create that file and dump the merged list to the file, using the format specified

The file format is as follows: a single integer, followed bythat numberof integers. That way you can open the file, read the first value, create an array of the appropriate size, and then read the rest of the file to populate the array. For example

10

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

is data in the specified format. The first 10 is the count, nota data item; the second one is.

Note that there can be more data items than indicated by the count; ignore the extras.

Every discrete task should be implemented as an independent method. At a minimum, you will have one sorting method and one merging method.

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

Murach's SQL Server 2012 For Developers

Authors: Bryan Syverson, Joel Murach, Mike Murach

1st Edition

1890774693, 9781890774691

More Books

Students also viewed these Databases questions

Question

2. Discuss the steps in preparing a manager to go overseas.

Answered: 1 week ago