Question

Write a JAVA program that declares and initializes an array with the following numbers: 10, 89,...

Write a JAVA 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

0 0
Add a comment Improve this question Transcribed image text
Answer #1
int[] myIntArray = new int[7];
int[] myIntArray = {1,2,3,4,5,6,7};
int[] myIntArray = new int[]{1,2,3,4,5,6,7};
Add a comment
Know the answer?
Add Answer to:
Write a JAVA program that declares and initializes an array with the following numbers: 10, 89,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Please complete this code for java Lab Write a program as follows: Create an array with...

    Please complete this code for java Lab Write a program as follows: Create an array with 10 elements. The array should contain numbers generated randomly between 1 and 100 Ask the user to enter any number - Search the array to see if the user entered number is in the array If the user-entered number is in the array, print a 'match found' message. Also print at which index the match was found, else print a 'match not found' message...

  • JAVA: (15 marks) Write a program that creates an integer array with 50 random values, prompts...

    JAVA: (15 marks) Write a program that creates an integer array with 50 random values, prompts the user to enter the index of an element in the array between 0 and 49, then displays the corresponding element value. If the specified index is out of bounds, display an error message (e.g. "Out of Bounds") and ask the user to enter another index. Use a while loop that will keep prompting the user until a valid input is received. To handle...

  • (JAVA) Write a program that maintains student test scores in a two-dimesnional array, with the students...

    (JAVA) Write a program that maintains student test scores in a two-dimesnional array, with the students identified by rows and test scores identified by columns. Ask the user for the number of students and for the number of tests (which will be the size of the two-dimensional array). Populate the array with user input (with numbers in {0, 100} for test scores). Assume that a score >= 60 is a pass for the below. Then, write methods for: Computing the...

  • Please write a Java program that does the following: Create an array of 100 integers. Store...

    Please write a Java program that does the following: Create an array of 100 integers. Store 100 random integers (between 1 and 100) in the array. Print out the elements of the array. Sort the array in ascending order. Print out the sorted array. Prompt the user to enter a number between 1 and 100. Search the array for that number and then display "Found" or "Not Found" message. Display each number from 1 to 100 and the number of...

  • Write a program that: program starts; declares and initializes to 10 an integer variable i; uses...

    Write a program that: program starts; declares and initializes to 10 an integer variable i; uses a do loop; print on new line “loop pass # “ and i; if i = 4 break default decrement i by 1 by stating i once; test condition i > 0; just before ending print on new line “Program finished!” then terminate program.

  • Java Programming Use a one-dimensional array to solve the following program. Write an application that inputs...

    Java Programming Use a one-dimensional array to solve the following program. Write an application that inputs six numbers [Keep the numbers in an array]. The numbers must be between 20 and 200, inclusive. If the number is not between 20 and 200, ask for another input. When a number is entered, display the number only if it is not a duplicate of a number already entered. If it is a duplicate of a number already entered, display a message that...

  • Write a program that performs the following operations on a one dimensional array with 50 unsigned...

    Write a program that performs the following operations on a one dimensional array with 50 unsigned integers. The main program will initialize the array, print the array values to the screen and then call a function that will determine and print the maximum and minimum values. •Declare the array and any other variables. •Use a loop to initialize the array with 50 random integer values between 0 and 99 using the rand() function. (number = rand() % 100;) •Using cout...

  • Write a Java program that generates an array of Fibonacci numbers. Specifications: The program -Fills a...

    Write a Java program that generates an array of Fibonacci numbers. Specifications: The program -Fills a one-dimensional array with the first 30 Fibonacci numbers using a calculation to generate the numbers. Note: The first two Fibonacci numbers 0 and 1 should be generated explicitly as in -long[] series = new long[limit]; //create first 2 series elements series[0] = 0; series[1] = 1; -But, it is not permissible to fill the array explicitly with the Fibonacci series’ after the first two...

  • Write a Java program in Eclipse. . Write a Java program that: 1. Creates an array...

    Write a Java program in Eclipse. . Write a Java program that: 1. Creates an array of 100 integers. Initialize the array to have all zeros. 2. Puts even numbers starting from 6 (excluding multiples of 12) into the first 50 slots of the array above. So numbers 6,8,10,14,16,18,20,22,26, etc. go into the first 50 positions in the array. Print the array. 3. Puts random numbers between 45 and 55 into the second 50 slots of the array above (second...

  • Write a JavaScript program that will do the following: Create an array of size 50. Store randoml...

    Write a JavaScript program that will do the following: Create an array of size 50. Store randomly generated number (between 0 and 10) into this array. Ask users what number they want to search in the array. Make sure user given number is between 0 and 10. Search the user given number in the array: If the program found the number in the array then display all the indexes where the number was found. If the program does not find...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT