Write a program that uses an array to find the average
Course:- JAVA Programming
Reference No.:- EM131599412

Assignment Help
Assignment Help >> JAVA Programming

1. Show two ways to declare a one-dimensional array of 12 doubles.
{1.0, 2.0, 3.0, 4.0, 5.0, 6.0,7.0, 8.0, 9.0, 10.0, 11.0, 12.0};
For the first example print the 7.0 and 10.0 in a println.
Example - Your println should match
For the first example print the 2.0 and 12.0 in a println.
Example - Your println should match

2.Write a program that uses an array to find the Average of 10 double values.
Use Math.random() in combination with a for loop to fill the array with 10 random values.
Then use a different for loop to iterate through the array when summing the total for all 10 double values.

Put your comment

Ask Question & Get Answers from Experts
Browse some more (JAVA Programming) Materials
Declare and initialize an integer variable named currentYear. Initialize this variable with the value of the currentYear. Use four digits for year. Use four digits for t
Write a function using JavaScript syntax to compute a person's gross pay for a week. The function must receive the number of hours worked and the rate of pay per hour.
A store owner wants to mix cashews and almonds. Cashews cost 2 dollars per pound and almonds cost 5 dollars per pound. He plans to sell 150 pounds of a mixture. How many pou
Write a method called 'range' that returns the range of values in an array of integers. The range is defined as 1 more than the difference between the maximum and minimum va
Prove that the difference of two odd integers is even. Give a justification at each step. Prove that the sum of any two rational numbers is a rational number. Give a justifica
Write a complete subclass of SimpleList named ListSet where the ‘add' method is overridden such that a ListSet will never contain duplicate items - Write a program to mainta
With this declaration of m in subclass B, any invocation of m on a B object will result in a special error indicating that the method should not be used. (a) What eff
Change the averages so that they are rounded to the nearest one hundredth. The example above shows averages in format - Change the program so that before the spreadsheet wind