Java Program: “Arrays, Files, and Sorting”

Java Program: “Arrays, Files, and Sorting”

 “Arrays, Files, and Sorting”

 

Part 1 – Make a number Generator main class

1. Randomize a number as the count, store the count in a file named numbers.txt

2. Using the first randomized number, create a loop generating new randomized numbers,

storing each new number on a new line in the text file each iteration.

example of what numbers.txt might look like:

11

3

2

8

23

18

7

14

19

1

3

20

example of another run of your program’s numbers.txt:

5 – this is the count

12 – this is the first number

9 – second number

5 – third

22 – fourth

5 – and fifth number

 

Part 2 – make a new file, a Sorting main class

1. Load the numbers.txt file from Part 1 of this project and read the data into an array. p. 545

2. Sort the numbers loaded in from number.txt from low to high using any sorting algorithm you like (for example, insertion sort). p. 251

3. Create a file named numout.txt and store the sorted numbers in the file, each number on its own line. p.544

 

Part 3 – Strings

Make a list of 10 names, each on it’s own line in a text editor and store them in a text file named names.txt. On the first line, however, type the number of name entries.

Part 4 – make a new file, a Names main class

Write a new class file with a main() method in the same project, use it to load in the names.txt, sort the names, and store them to a file called, nameout.txt. Each name on its own line.

example:

if your names.txt file is:

7

Bible, James

Skywalker, Luke

Hogan, Robert

Austin, Steve

Nelson, Anthony

Hawking, Stephen

Lucas, George

your nameout.txt should be:

Austin, Steve

Bible, James

Hawking, Stephen

Hogan, Robert

Lucas, George

Nelson, Anthony

Skywalker, Luke

 

 

"You need a similar assignment done from scratch? Our qualified writers will help you with a guaranteed AI-free & plagiarism-free A+ quality paper, Confidentiality, Timely delivery & Livechat/phone Support.


Discount Code: CIPD30


WHATSAPP CHAT: +1 (781) 253-4162


Click ORDER NOW..

order custom paper