File Name: ArrayOperations.java Class Name: ArrayOperations Problem Description: Write a program to perform the following operations on an array: 1. Initialize integer arrays with input values 2. Print array 3. Search a number and return its index if it is present otherwise return -1 4. Find the smallest odd number from the array 5. Exit Note: To find the smallest number, it is required initialize the smallest number variable to the larger number which is not present in the array. You can initialize the smallest number to Integer.MAX_VALUE; Guidelines: 1. Use switch case and while loop. 2. Variables to declare in main method- An array of integer datatype 3. Use methods to write each operation listed in problem description and pass array as an argument to all methods. Steps to follow: 1. Declare anarray of size 5 2. Display array operations 3. Input user choice 4. Use the switch case to call the appropriate method 4. Implement the methods in your program for all operations listed in the problem description 5. Loop again to display array operations. Provide and exit the loop (hint: use return statement) Operations 1. Initialize Array 2. Print Array 3. Search a number 4. Find smallest odd number 5. Exit Enter your choice: 1 Enter the array values: 11 12 13 14 15 Operations 1. Initialize Array 2. Print Array 3. Search a number 4. Find the smallest odd number 5. Exit Enter your choice: 2 Array - 11 12 13 14 15 Operations 1. Initialize Array 2. Print Array 3. Search a number 4. Find the smallest odd number 5. Exit Enter your choice: 3
File Name: ArrayOperations.java Class Name: ArrayOperations Problem Description: Write a program to perform the following operations on an array: 1. Initialize integer arrays with input values 2. Print array 3. Search a number and return its index if it is present otherwise return -1 4. Find the smallest odd number from the array 5. Exit Note: To find the smallest number, it is required initialize the smallest number variable to the larger number which is not present in the array. You can initialize the smallest number to Integer.MAX_VALUE; Guidelines: 1. Use switch case and while loop. 2. Variables to declare in main method- An array of integer datatype 3. Use methods to write each operation listed in problem description and pass array as an argument to all methods. Steps to follow: 1. Declare anarray of size 5 2. Display array operations 3. Input user choice 4. Use the switch case to call the appropriate method 4. Implement the methods in your program for all operations listed in the problem description 5. Loop again to display array operations. Provide and exit the loop (hint: use return statement) Operations 1. Initialize Array 2. Print Array 3. Search a number 4. Find smallest odd number 5. Exit Enter your choice: 1 Enter the array values: 11 12 13 14 15 Operations 1. Initialize Array 2. Print Array 3. Search a number 4. Find the smallest odd number 5. Exit Enter your choice: 2 Array - 11 12 13 14 15 Operations 1. Initialize Array 2. Print Array 3. Search a number 4. Find the smallest odd number 5. Exit Enter your choice: 3
Chapter8: Arrays
Section: Chapter Questions
Problem 9PE
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 6 steps
Recommended textbooks for you
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage