Welcome to lab 9!
If you have checkpoints from the last lab to show your instructor or TA, do so immediately. No credit will be given if you have not already completed the work, nor will credit be given after the first 10 minutes of this lab.
In this lab you will work with data that has been collected into arrays. Arrays let us number our data, making it easy to loop through the collection or associate data with the natural numbers.
Person A types.
Solve one of the following problems:
Stringnames. You want to select 5 of them for a drug test. Repeat subjects are not allowed. Write a method
pick5that accepts an array containing the 10 names as a parameter and prints 5 unique names drawn at random.
Stringarray. Write a method
enumeratePairsthat receives this array as a parameter and enumerates all possible president/vice president pairs. For example, if the list contains Alice, Bob, and Carol, then the possible tickets are:
P: Alice, VP: Bob P: Alice, VP: Carol P: Bob, VP: Alice P: Bob, VP: Carol P: Carol, VP: Alice P: Carol, VP: Bob
for each cell in the list find the smallest value in the sublist starting at the current cell swap that smallest value with the value in the current cellWrite a method
selectionSortthat receives an array of
ints as a parameter and sorts it using this algorithm.
Person B types.
Complete a second problem from the list above.