Exercise 1: 1) Declare and initialize an array of 10 double values. Assign random values to each array element. Hint: You need to use the Random class library. 2) Traverse this array and print all the values. 3) Sort the values in this array in descending order and print all the values.
Exercise 1:
1) Declare and initialize an array of 10 double values. Assign random values to each array element.
Hint: You need to use the Random class library.
2) Traverse this array and print all the values.
3) Sort the values in this array in descending order and print all the values.
Exercise 2:
1) Declare and initialize an array that keeps records of 10 items. Each item has a name, quantity in stock, and a sale price. Assign random values to numeric fields of each new item, and give sequential item names to each of them: "Item #01". "Item #02," "Item #03," ...
Hint: You need to use the Random class library.
2) Traverse this array and print all the items.
3) Sort the values in this array in ascending order of quantity in stock and print all the items.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images