US history 1301. Need History Professor. Exam

profileMami
Lab-6ArraysInJava-Fall2020-1.pdf

Programming Fundamentals II – JAVA Programming COSC 1437

Glen Grimes

Lab #6 – Arrays

NAME

Problem: Develop a program which allows the user to enter numbers into an array. Input will

be as follows:

The user will enter the total number of integers to be entered into the array.

The user will then enter that number of unique integers (negative or positive). Do not allow the

number of values entered to exceed the array size.

Develop methods (SIX) including:

The ‘main’ method

Print the array

Sort the array ( YOU MUST DEVELOP YOUR OWN SORT METHOD – don’t

use the API classes)

Determine the highest value

Determine the lowest value

Calculate the average value (double)

Due: TBD

Note:

Labs are due promptly at the BEGINNING OF CLASS.

Program Logic (algorithm):

- Prompt and get the size of the array

- Create the array of that size

- Loop through the initialization of the array

o Prompt the user for each value

o Save the value in the corresponding element of the array

- Print the array (using the method)

- Sort the array(using the method)

- Print the array again(using the method)

- Output the highest value(using the method)

- Output the lowest value(using the method)

- Output the average(using the method)