Write a complete Java
Want to see the full answer?
Check out a sample textbook solutionChapter 7 Solutions
Java: An Introduction to Problem Solving and Programming (8th Edition)
Additional Engineering Textbook Solutions
Starting Out with Python (4th Edition)
Starting Out with C++: Early Objects (9th Edition)
C How to Program (8th Edition)
Starting Out with Python (3rd Edition)
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
- Write a Java program named Findletter that asks the user to enter 10 letters and store them in an array. Then it should ask the user to enter a letter (char value) to search for it. Then, if the entered letter is found, the program should display the message "The letter is in the array", otherwise it should display the message "The letter is not in the array".arrow_forwardWrite a program that creates a 2D array of size 4x5. Then, user enters the elements for this 2D array. Display the array in tabular form, using manipulators.arrow_forwardWrite a program that creates and initializes an array with the following four values: 2.3, 4.5, 8.0, and 2.1. Use a for loop to print the array elements and then use a for loop to print the array elements in reverse order. Using java programmingarrow_forward
- Given an array below, write a program in Java language to print all numbers which are greater than the average of all numbers in the array. int []array = {1,10,-8,16,-12,34,0,19,-23,14}arrow_forwardJAVA PROGRAM Write a program that asks the user to input two integers a and b. Then create an array that has all integer from a to b. Print out the array. (Don’t forget to consider the situation of a=b, a<b, and a>b.) Example 1: Input two numbers: 6 2 Array is [6, 5, 4, 3, 2] Example 2: Input two numbers: 4 8 Array is [4, 5, 6, 7, 8] Pass the above array as a parameter to a method called average and return the average and print it out in the main method. (Do not use Math library to get the average.)arrow_forwardJAVAWrite a program that searches person's name and display all matched name. For example, if a user inputs the letter "Davis", the program searches all name which includes "Davis" in an array. Then, display all matched names on the screen. You must declare a single dimensional array which has all people’s name. Use methods of string classarrow_forward
- JAVA PROGRAM Ask the user for the number of rows and columns of a two-dimensional array and then its integer elements. Rotate the array 90 degrees counter-clockwise and print the new result. Input 1. One line containing an integer for the number of rows The value is guaranteed to be >= 3 and <= 100. 2. One line containing an integer for the number of columns The value is guaranteed to be >= 3 and <= 100. 3. Multiple lines containing at least one integer each line for the elements of the array All elements are non-negative and are all less than 100 SAMPLE OUTPUT: Enter the number of rows: 4 Enter the number of columns: 4 Row #1: 1 3 3 4 Row #2: 5 6 7 8 Row #3: 9 10 10 12 Row #4: 12 14 17 16 4 8 12 16 3 7 10 17 3 6 10 14 1 5 9 12arrow_forwardWrite a java program that creates an array of one hundred random numbers (the range of the random numbers must be between 150 and 999 inclusive). Then it should find out and display: 1- how many even numbers in the array. 2- The average of all numbers in the array. 3- how many numbers are greater than the average in the array.arrow_forwardIn Java, create a program that gets user input to create an array of books. The length of the array should be determined by how many books the user enters. You may ask the user how many books they will enter. After all books have been entered by the user, invoke a method to display the contents of the array in a table. Each book will have a title, author, cover, pages, copyright (year), read time (float).arrow_forward
- Q2. Write a Java program named RandomNumbers that creates a single-dimensional array of int of size 20 and initialize its elements with 20 random integer numbers (their range must be between 1 and 100 inclusive. Write statements in your program to display the array elements, and how many odd and even numbers are there in the array. For example, if the random numbers were stored in the array are: 83 48 89 66 40 94 31 31 12 45 45 87 10 24 78 2 28 31 52 46 Then the program should display: The random numbers are: 83 48 89 66 40 94 31 31 12 45 45 87 10 24 78 2 28 31 52 46 There are 8 odd numbers There are 12 even numbers An element in the array is a peak (max or min) if the elements before and after that element are greater than the element itself (min) or the elements before and after that element are less than the element (max). Write a method in your program called displayPeaks…arrow_forwardWrite a Java program named RandomNumbers that creates a single-dimensional array of int of size 20 and initialize its elements with 20 random integer numbers (their range must be between 1 and 100 inclusive. a) Write statements in your program to display the array elements, and how many odd and even numbers are there in the array. For example, if the random numbers were stored in the array are: 83 48 89 66 40 94 31 31 12 45 45 87 10 24 78 2 28 31 52 46 Then the program should display: The random numbers are: 83 48 89 66 40 94 31 31 12 45 45 87 10 24 78 2 28 31 52 46 There are 8 odd numbers There are 12 even numbers b) An element in the array is a peak (max or min) if the elements before and after that element are greater than the element itself (min) or the elements before and after that element are less than the element (max). Write a method in your program called displayPeaks that will take a single-dimensional array as parameter and display all peak elements of…arrow_forwardWrite a Java program named RandomNumbers that creates a single-dimensional array of int of size 20 and initialize its elements with 20 random integer numbers (their range must be between 1 and 100 inclusive. a) Write statements in your program to display the array elements, and how many odd and even numbers are there in the array. For example, if the random numbers were stored in the array are: 83 48 89 66 40 94 31 31 12 45 45 87 10 24 78 2 28 31 52 46 Then the program should display: The random numbers are: 83 48 89 66 40 94 31 31 12 45 45 87 10 24 78 2 28 31 52 46 There are 8 odd numbers There are 12 even numbersarrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT