/*Write a Java program that generates 1000 random integers, * calculates the average and prints two counts, one for the * numbers lower than the average and one for the numbers larger than the average. */
Use java thanks
SOURCE CODE IN JAVA:
import java.util.Random;
class RandomNumbers
{
public static void main(String args[])
{
Random r=new Random(); //creating object of Random class to use
nextInt() to generate integers
final int BOUND=1000; //random integers will be in the range 0 to
BOUND
int arr[]=new int[1000]; //creating empty array of size 1000
double sum=0; //to store sum of elements
for(int i=0;i<1000;i++) //filling the array and calculating the
sum of elements
{
arr[i]=r.nextInt(BOUND+1);
sum+=arr[i];
}
double avg=sum/1000; //calculating average of elements
int above=0,below=0; //to store two counts, above average and below
average
for(int i=0;i<1000;i++) //counting above average and below
average
{
if(arr[i]>avg)
above++;
else if(arr[i]<avg)
below++;
}
//output
System.out.println(avg+" is the average");
System.out.println(above+" numbers were above average");
System.out.println(below+" numbers were below average");
}
}
OUTPUT:
/*Write a Java program that generates 1000 random integers, * calculates the average and prints two...
A. Create a java program that generates 1000 random integers. Write the 1000 random integers to a file using the Formatter class. B. Create a second java program that opens the file with the 1000 integers using the Scanner class. Read in the integers and find and print out the largest, smallest and the average of all 1000 numbers. C. Repeat A from above but use the BufferedWriter class B. Repeat B from above but use the BufferedReader class.
Java Programming - Write a program that generates two random integers, both in the range 25 to 75, inclusive. Use the Math class. Print both integers and then display the positive difference between the two integers, but use a selection. Do not use the absolute value method of the Math class.
with explanation Write a C++ program that calculates and prints the average of several integers. Assume that the last value read with cin >> is the number 9999. For example, for an input sequence: 10 8 11 7 9 9999 The output should be 9.00
c# prograaming language 1. write a program that generates 10,000 random integers in the range of 0-9 and them in binary search tree. 2. use any sort algorithm (insertion, bubble, quick...) to display a list of each of the integers and how many times they appear. 3. at last, add ruction to the BinarySearchTree class that count the number of edges in a tree. Write a program that generates 10,000 random integers in the range of 0-9 and store them...
*IN PYTHON* (Count single digits) Write a program that generates 1,000 random integers between 0 and 9 and displays the count for each number. (Hint: Use a list of ten integers, say counts, to store the counts for the number of 0s, 1s, ..., 9s.) Rubric 5 pts: Proper use of list to count occurrences of numbers 5 pts: Proper calculations of counts 5 pts: Proper output Note: No software dev plan or UML required
JAVA. Write a program that reads in a series of positive integers and prints out the maximum value entered. The user will indicate they are finished entering numbers by entering zero or a negative integer.
java CountDigits.java Write a program that calculates and prints, the sum and product of all the digits in an integer value read from the keyboard.
C++ Write a program that generates and prints 24 random values using an array and the rand () function. Implement an algorithm to find the maximum and a minimum number of random numbers generated. Use the header "#include <ctime>", "#include <cstdlib>" in addition to the usual header: "#include <iostream>"
Write code that prints 500 random integers that are each less than 1000.
Write a program that prompts the user for two integers and then prints The sum The difference The product The average The distance (absolute value of the difference) The maximum (the larger of the two) The minimum (the smaller of the two) hint: python defines max and min functions that accept a sequence of values, each separated with a comma. **program must be written in Python**