Question: Very basic Java exercise. Question Write a program that uses a Scanner object to read in a sequence of marks out of 100. The first

Very basic Java exercise.

Very basic Java exercise. Question Write a program that uses a Scanner

Question Write a program that uses a Scanner object to read in a sequence of marks out of 100. The first number in the sequence will be an integer and represents the number of marks (n). The rest of the numbers in the sequence represent marks and can contain decimals Create an array of doubles that uses the first number as the size (n). Then the program will read each mark (a double) and place it in the array. Print the sum and average of all the marks (use printf to control to 2 decimal points) on different lines Details Input A sequence of marks (doubles), where the first value is an integer that represents the number of marks Output The sum of the array and the average of all the marks (There is empty line between Sum and Avg) Examples Sample Input Sample Output Sum: 414.00 Average: 82.80 5 98 67.5 78 80 90.5 8 56 78.5 78 67.5 95 84 88.5 65 Sum: 612.50 Average: 76.56

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!