Question: Complete and submit the program source code that satisfies the following requirements: 1. Create a new class named ArrayDemo.java. This class will have a main()

Complete and submit the program source code that satisfies the following requirements:

1. Create a new class named ArrayDemo.java. This class will have a main() method that does the following:

a. Declares and initializes (on one line) an array of six (6) integers. Name the array grades

b. The grades should be between the values of 0 and 100.

c. Declares a float variable named average, that is initially set to zero (0)

d. Has a for loop that uses the .length of the grade array as the condition for continued looping. This for loop should display the mark number and its value (e.g. Mark 1 = 78). As well, each loop through should add the mark to the average variable

e. After the loop finishes executing the average variable should be divided by the number of total marks (the result being stored in average itself). The average should be display. N.B. do not use the literal value (i.e. the number 6) as the denominator in the average calculation

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!