Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Project 6 Due May 24 by 4:50pm Points 30 Submitting on paper Available after May 8 at 3:30pm Computer Science 111 Introduction to Algorithms and

Project 6

Due May 24 by 4:50pm

Points 30

Submitting on paper

Available after May 8 at 3:30pm

Computer Science 111 Introduction to Algorithms and Programming: Java

Programming Project #6 Arrays, Files, and Sorting (20 points)

Phase 1 - Numbers

Below a list of integer numbers of which the first one will be an exact count of the remaining numbers in the list. So if the first number in the list is 500, there will be 500 additional numbers in the list.

Copy and paste the number data, including the count into a plain text file with the name of the input file given. Your mission, if you choose to accept it, is to write a console program ( NO GUI ). Open and read the first line of this input file and create an integer array with the name of the array given and a size to match the first line of the file. So if the first line of the file contains 500, the array will have 500 slots. Read the remaining numbers into the array. Write a method named sort, which takes the array as a parameter, and sorts it from low to high. When the sort is complete, open and write a file with the name of the output file, the count will be first, followed by the sorted list of numbers (one per line). Finally, write a simple loop to compute the average of the numbers in the list (not including the count). Output this average as the last line of the output file. Be sure to use a double data type for the sum and average variables.

numbers.txtimage text in transcribed (939 numbers long)

Phase 2 - Strings

Below is a list of Strings of which the first one will be an exact count of the remaining Strings in the list. So if the first string in the list is 200, there will be 200 additional Strings in the list.

Copy and paste the String data, including the count into a plain text file with the name of the input file given. Your mission, if you choose to accept it, is to write a console program ( NO GUI ). Open and read the first line of this input file and create a String array with the name of the array given and a size to match the first line of the file. So if the first line of the file contains 200, the array will have 200 slots. Read the remaining Strings into the array. Write a method named sortstrings, which takes the array as a parameter, and sorts it from low to high. When the sort is complete, open and write a file with the name of the output file, the count will be first, followed by the sorted list of Strings (one per line). Finally, output the String in the middle of the array as the last line of the output file. So if there are 11 slots in the array, the middle item will be in slot 5 of the sorted array. If there are an even number of slots take the lower slot number. So if there are 10 slots in the array, the middle item will be in slot 4 of the sorted array.

inputstrings.txtimage text in transcribed (array length 212)

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

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 2012 Proceedings Part 2 Lnai 7197

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284892, 978-3642284892

More Books

Students also viewed these Databases questions

Question

A set is bounded if and only it is contained in some open ball.

Answered: 1 week ago