Write a java program that takes in integers from the user into an array named
numbers with size entered by the user :
The program generates an array index randomly: (use random()
method) If the cell of that index has positive value change it to
negative value,
If the cell has negative value change it to positive.
The program prints the array before and after the change.
The program prints all index values not generated randomly
Notes:
Decided that the number of randomly generated indexes is about half the
size of the array. (If the array size is 100 then generate 50 random numbers
for indexes)
It is important to note that: If the index number generated more than
once, the user will hear an announcement and generate one more index
More: (How will we know if the index number already generated ??? )
Comments
Leave a comment