Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Modify the following java program to have the flowing output: Documentation: 10 points Exact output: 30 points Modified/added/edited code: 60 points arraySearch-3.java Hint: needs
Modify the following java program to have the flowing output: Documentation: 10 points Exact output: 30 points Modified/added/edited code: 60 points arraySearch-3.java Hint: needs a do-while! ==>> Array Search program Enter a number to search for: 2 found it! :) Enter any number to continue or number 0 to exit: 5 =>> Array Search program Enter a number to search for: 6 Sorry not found it! :( Enter any number to continue or number 0 to exit: 0 ==> End of the Search Program! Choose /* *Array Search package int2200.week7; import java.util.Scanner; public class arraySearch { public static void main(String[] args) { // create and initializ an arry int[] numbers = {2, -9, 0, 5, 12, 25, 22, 9, 8, 12}; int key; boolean foundit = false; // declare a vraiable and initialize it to false Scanner input = new Scanner(System.in); // Create a Scanner object System.out.println("=>> Array Search program "); System.out.print ("Enter a number to search for: "); key = input.nextInt(); // access all elements using for each loop for (int i=0; i < numbers.length; i++) { if (key == numbers [i]){ } foundit=true; if (foundit == true){ System.out.println("found it! :)"); }else { } System.out.println("Sorry notfound it! :("); System.out.println("==> End of the Search Program "); } 1 =>> Array Search program Enter a number to search for: 2 found it! :) >End of the Search Program "/ C Q Search Bing $ 64 #3 E R LL D 75 % L 96 T Y &7 * 8 U 61 ) 0 O F P
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started