Question: 2. Create a class named loseMe2D and complete the same tasks as the above, with the following changes: a. Ask the user how many rows

 2. Create a class named loseMe2D and complete the same tasks

2. Create a class named loseMe2D and complete the same tasks as the above, with the following changes: a. Ask the user how many rows and how many columns of numbers they would like. b. Use the user's entries to build a 2D array to hold their numbers. C. This time, instead of doubling each number, you should subtract one from each number. d. If done correctly, the output will look something like the following: // User picks how many // User picks how many // For-Loop used to ask for the entries // Row/column #s displayed using loop counter How many rows would you like: 2 How many columns would you like: 3 Enter row 1 column 1:5 Enter row 1 column 2:1 Enter row 1 column 3:7 Enter row 2 column 1:2 Enter row 2 column 2:9 Enter row 2 column 3:6 Here is your array: 5 17 296 Here is your new array: 4 06 1 8 5 // For-Loop prints user's entries in matrix form // 1 was subtracted from all numbers 3. Create a new class named numMatches. Complete the following: a. Use an initializer list to initialize an array of integers named arr to the following: 3,4,5,9,2,0,1 b. Use an initializer list to initialize an array of integers named arr2 to the following: 2, 4, 1, 9, 7, 0,6 c. Write a for-loop to traverse the arrays and count the # of times numbers appear in parallel positions. d. Output the number of matches. The output should look like the following: There were 3 matches! e. Test your code by changing the arrays from steps a and b and verify (always have the same array length) 4. Create a new class named howManyTimes. Make a new empty array that can hold 15 integers. Use a for-loop to have the user fill the array with 15 integers (instruct them to only enter integers 1-10, do not worry if the user breaks this rule). Print the array to the screen. Then ask the user what integer they would like to search for. Count the number of times their integer appears in the array and output that information to the user. 5. Create a new class named findMyNumber. Copy and paste your code from the howManyTimes class above. Edit the code so that the for-loop no longer counts how many times a number occurs, but now simply looks for a specific number. Use a boolean variable to track whether or not the number is in the array. If found, display "Number in array: true". If not found, display "Number in array: false

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!