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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
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)
Transcribed Image Text: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
Transcribed Image Text: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
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 6 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education