
Write a java
Plesiosaurs provide a scree

Java Program-
import java.util.Scanner;
public class Array
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
//creates an array in the memory of length 10
int[] array = new int[10];
for(int i=0; i<10; i++)
{
//reading array elements from the user
array[i]=sc.nextInt();
}
System.out.println("Array elements are: ");
int sum = 0;
int max,min,avg;
max = min = array[0];
// accessing array elements using the for loop
for (int i=0; i<10; i++)
{
sum += array[i];
if(array[i] > max)
max = array[i];
else if (array[i] < min)
min = array[i];
System.out.print(array[i]);
}
// calculating Average
avg=sum/10;
// printting max, min, sum Average
System.out.println(" ");
System.out.println(" Maximum : " + max);
System.out.println(" Minimum : " + min);
System.out.println(" Sum : " + sum);
System.out.println(" Average : " + avg);
}
}
Step by stepSolved in 2 steps with 1 images

- Write a Java program that creates an array of integers with length 5 and fills it with the number 1 through 5 then loop through the array and print out each elementarrow_forwardGiven an array below, write a Java program to take input an integer n from the user and print the "True" or "False" depending upon the number n is present twice in the array or not. int [Jarr = {12,-67,13, 15, 12, 15, -67, 0, 1,1}arrow_forwardSolve by javaarrow_forward
- Write a Java program that reads an integer N from the user and declares an integer array of size N. It then inputs N non-negative integers from the user into the array and do the following: 1. Finds and prints the minimum, maximum, sum, and average of the numbers. 2. Displays array data as a histogram – graphically by plotting each numeric value as a bar of asterisks (*) as shown in the example diagram. This is somehow similar to Lab11 Sample output 9 Enter the size of array: Enter 9 integer values: 10 19 14 Minimum -o Maximum - 19 = 68 Sum Average = 7.55 ========== Histogram: - ------= Element Ualue Hintogran 19 ***** ***** 11arrow_forwardwrite the java programarrow_forwardWrite a program to accept 10 positive and negative values in an integer array. Program would shift all negative values to the left side and all positive values to the right side of the array without sorting them. Use Java coding Language.arrow_forward
- Write a Java program with a single-dimension array that holds 10 integer numbers and identify the maximum value of the 10 numbers. Next sort the array using a bubble sort and display the array before and after sorting. Psuedocode Generate 10 random integer numbers between 1 and 100 place each random number in a different element of a single-dimension array Display the array's contents unsorted as they are generated Using the bubble sort, sort the array from smallest integer to the largest. //must use the following: Bubble Sort Code: public static void bubbleSort(int[] list) { int temp; for (int i = list.length - 1; i > 0; i--) { for (int j = 0; j < i; j++) { if (list[j] > list[j + 1]) { temp = list[j]; list[j] = list[j + 1]; list[j + 1] = temp; }…arrow_forwardIn java Define and create a 2-dimensional array of integers with 4 rows and 8 columns. Print the elements of the array in table format (rows and columns). Replace the element in the second row and third column of the array with the value 99.arrow_forwardWrite the following Java program Allocate an array a of ten integers. Put the number 17 as the initial element of the array. Put the number 29 as the last element of the array. Fill the remaining elements with –1. Add 1 to each element of the array. Print all elements of the array, one per line. Print all elements of the array in a single line, separated by commas.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





