Create a menu driven program that does the following: Single Array Project Enter values for List 1 Enter values for List 2 Display sorted Merged List sorted Search the Merged List for a certain number Count the occurrence of each number in the merged list Exit program Menu Option 1: Enter the positive integer values from the keyboard for List 1. Enter a maximum of 10 numbers. But, you do not have to enter 10 numbers. Negative 1 (-1) signify the end of your list. Menu Option 2: Enter the positive integer values from the keyboard for List 2. Enter a maximum of 10 numbers. But, you do not have to enter 10 numbers. Negative 1 (-1) signify the end of your list. Menu Option 3: Merge List 1 and List 2. Sort and display the merged list. Menu Option 4: Get a number to search for from the user. Search for that number in the MERGED list and give the index position. If the number is not found, let the user know. Menu Option 5: Count the occurrence of each unique number in the MERGED listed. A sample output is below: Merged numbers: 2, 5, 6, 5, 4, 3, 23, 43, 2, 0, 5, 3, 23, 2, 5, 232 occurs 3 times3 occurs 2 times4 occurs 1 time5 occurs 4 times6 occurs 1 time23 occurs 3 times43 occurs 1 timeNote that if a number occurs more than one time, the plural word “times” is usedin the output. Note: ALL Menu options above should invoke at least one method call to perform that task. *** Additional Code Requirements: *** Be sure to create a comment block header as described in class. Be sure to document your code and let the user know exactly what they are to input from the keyboard and exactly what they are looking when you display output. Now is a good time to make use of a static input stream as discussed in class (i.e. static Scanner input = new Scanner(System.in)) declared outside the main but within the class so that all of your classes can use the same input variable rather than declaring many variables that do the same thing. You are not required to use the java.util.Arrays methods but you are more than welcome to use them. Be sure to use at least one foreach loop in your code.
Create a menu driven program that does the following:
Single Array Project
- Enter values for List 1
- Enter values for List 2
- Display sorted Merged List sorted
- Search the Merged List for a certain number
- Count the occurrence of each number in the merged list
- Exit program
Menu Option 1: Enter the positive integer values from the keyboard for List 1. Enter a maximum of 10 numbers. But, you do not have to enter 10 numbers. Negative 1 (-1) signify the end of your list.
Menu Option 2: Enter the positive integer values from the keyboard for List 2. Enter a maximum of 10 numbers. But, you do not have to enter 10 numbers. Negative 1 (-1) signify the end of your list.
Menu Option 3: Merge List 1 and List 2. Sort and display the merged list.
Menu Option 4: Get a number to search for from the user. Search for that number in the MERGED list and give the index position. If the number is not found, let the user know.
Menu Option 5: Count the occurrence of each unique number in the MERGED listed. A sample output is below:
Merged numbers: 2, 5, 6, 5, 4, 3, 23, 43, 2, 0, 5, 3, 23, 2, 5, 23
2 occurs 3 times
3 occurs 2 times
4 occurs 1 time
5 occurs 4 times
6 occurs 1 time
23 occurs 3 times
43 occurs 1 time
Note that if a number occurs more than one time, the plural word “times” is used
in the output.
Note: ALL Menu options above should invoke at least one method call to perform that task.
*** Additional Code Requirements: ***
- Be sure to create a comment block header as described in class.
- Be sure to document your code and let the user know exactly what they are to input from the keyboard and exactly what they are looking when you display output.
- Now is a good time to make use of a static input stream as discussed in class (i.e. static Scanner input = new Scanner(System.in)) declared outside the main but within the class so that all of your classes can use the same input variable rather than declaring many variables that do the same thing.
- You are not required to use the java.util.Arrays methods but you are more than welcome to use them.
- Be sure to use at least one foreach loop in your code.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images