Max3.java: Write a program that reads 10 integers and displays top 3 records (i.e., the largest three elements). Please consider the extreme case when all integers are negative. For instance, by given -1, -2, …, -10, the display will be -1, -2, and -3.
import java.util.Scanner; public class Max3 { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Enter 10 numbers: "); int[] arr = new int[10]; for (int i = 0; i < 10; i++) { arr[i] = in.nextInt(); } for (int i = 0; i < arr.length; ++i) { for (int j = 0; j < arr.length - 1; ++j) { if (arr[j] > arr[j + 1]) { int temp = arr[j]; arr[j] = arr[j + 1]; arr[j + 1] = temp; } } } System.out.println("Three largest numbers entered are " + arr[9] + ", " + arr[8] + " and " + arr[7]); } }
Max3.java: Write a program that reads 10 integers and displays top 3 records (i.e., the largest...
MinAvg.java: Write a program that reads 10 integers and displays its minimum and average. Please consider the extreme case when all integers are positive. For instance, by given 1, 2, …, 10, the minimum will be 1.
Task 1 : Write a Java program that prompts for and reads 10 integers from the user into an integer array of size 10, it then: - calculates the sum and average of positive numbers of the array and displays them. [Note: consider 0 as positive] Note: The program must display the message: "There are no positive values" if the array does not contain any positive value.
Write a program that reads k integers and displays their sum. Write a program that reads k values representing family income from the keyboard and place them into the array. Find the maximum income among these values. Count the families that make less than 10 percent of the maximum income. (JAVA)
Write a C++ program that reads a list of numbers 10 and displays largest, second largest and third largest. Note: Please do it with loops don't used arrays
In Java Write a program that reads an arbitrary number of 25 integers that are positive and even. The program will ask the user to re-enter an integer if the user inputs a number that is odd or negative or zero. The inputted integers must then be stored in a two dimensional array of size 5 x 5. Please create 3 methods: 1. Write a method public static int sum2DArray( int [1] inputArray ) The method sums up all elements...
3. Write a Java method (called sumOfSquares) that reads in a sequence of integer numbers using a Scanner object. As each integer is read, the method displays that integer. The method also accumulates the sum of the squares of the integers and displays the sum when all integers are read. The method reads integers until a negative integer is read. The negative integer should not be display or added to the sum of squares. The method will not return a...
I need to write a C++ program that reads two integers from a data filed called "integers.dat" The first integer should be low and the other one high. The program should loop through all integers between the low and high values and include the low and high integers and then display Display the integers in the file Displays the number of integers divisible by 5 OR 6, but not both. Displays the sum of the integers from condition 2 as...
Write a java program that reads a file (names as textfile) uploaded with assignment and displays the words of that file as a list. Then display the words in reverse order. Then display them with all plurals (ending in "s") capitalized. Then display them with all plural words removed.
Q1. Write a C++ program that reads two integers a, and, b on the keyboard to calculate: U = (a + b)2 and V = (a - b)2 Q2. Write a C++ program to read a sequence of positive integers and to display the largest integer of that sequence. Use a negative integer to indicate the end of the data entry.
Problem 1: Write a program that reads a positive float number and displays the previous and next integers. Sample Run: Enter a float: 3.5 The previous and next integers are 3 and 4. Problem 2: Write a program that reads two integers and displays their sum, difference, product, and the result of their division. Sample Run: Enter two integers: 8 5 Sum: 8, Difference: 3, Product: 40, Division: 1.6 Problem 3: Write a program that reads a three-digit integer from...