Question: The program should begin by asking the user to type in an odd number between 5 0 0 and 1 0 , 0 0 0

The program should begin by asking the user to type in an odd number between 500 and 10,000. Make sure to use input validation to confirm the number is of that size and is odd.
Then by using that number, you need to create an array of that size and fill it with random integers between -1000 and +1000. But you need to make sure that only even numbers are used, no odd numbers should be inside the array. Then after the array is filled, reset the middle number of the array to zero, replacing whatever was in there before with a 0
Now using this large array where the middle number is zero, you need to convert every number before the middle zero to a -1 if the number is positive. In a similar way every number after the middle number that is negative to a +1.
For example: If the array was size 11(to small for the assignment, but good for an example) it might start like: 6-48-2088456304-188-980984422
But then you convert the middle number to 0.
6-48-20880304-188-980984422
Now adjust all the positive numbers in the first half:
-1-4-1-20-10304-188-980984422
Now adjust all the negative numbers in the second half:
-1-4-1-20-1030411984422
Now print off all the numbers of the array to the screen that are not 1 or -1. You should have a newline after every 15 numbers. So your output might look like:
-80-70-984-200-30-20-4-68-90-120-320-76-4422-78-72-20564898521201661688104414862124414512200
Note the lack of 1s
Finally write the entire array (skipping nothing) to a file called numberData.txt;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!