Dr.java simple basic coding program

Anonymous
timer Asked: Jul 16th, 2017

Question Description

Write a program that asks the user for 5 numbers and stores them in an array called data. Then call a method that accepts the array as an argument, sorts the array in ascending order (use selection sort) and prints out the original AND sorted array (Hint: The method does not return anything in this case, so it should be set to void).

2- Write a program that declares and initializes an array with the following numbers: (10, 89, 50, 24, 60, 1, 15). Then ask the user for a number and check if the array contains that number. If it does, return a message to the user (print to screen) that says “Number found at position x “, where x is the location of that number in the array. If the number is not found, print a message to the screen that says “Number not found in array, please try again”. Implement the binary search algorithm (in a method) for locating the number in the array.

Hint: You have to sort the array first, use the method you used in Q1 above. The position you return will be in the sorted array! Not the original array.

This question has not been answered.

Create a free account to get help with this and any other question!

Similar Questions
Related Tags

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors