Java assignment1

profileWhite
ICA01.pdf

Page 1 of 2 Updated on: 2020-01-23

CPS 151/Spring 2020 In-class Assignment 1

Textbook reference: See discussion of how to insert (add) and remove (delete) an item in a partially filled

array while maintaining order of existing items (subsections 6.3.6, 6.3.7). The concept of a partially filled array

is discussed in subsection 6.1.3.

The program is supposed to:

a) allocate storage for an array of integers of a size specified by the user

b) fill the array partially with increasing values (number of values chosen by the user)

c) check that the item at a user specified index position can be removed, maintaining order of other elements

d) check that a new item can be added at a user specified index position, also maintaining order of other

elements.

Study the startup code and complete the program.

You need to complete the validity checks for index position specified by the user. Note that only existing items

may be removed, but a new item could be added right after the existing items in the list.

Sample output from startup code

Page 2 of 2 Updated on: 2020-01-23

Sample Output (successful insert/delete)

Sample output with invalid delete/insert positions