Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Need Java program that does averaging of grades like (70, 80, 90, 100) with the

ID: 3545321 • Letter: N

Question

Need Java program that does averaging of grades like (70, 80, 90, 100) with the following criteria:

public class AveragingGrades

//Declare 2 string variables called "grade" and "strSize" //Declare a float variable called "average" //Declare an int variable called "size"

// Print out a question for user that says, "How many grades will you enter?" //Get input from user and put it in a variable "strSize"

//Create "for" loop wrapper code here that loops "size" times.

//use "i" as the variable name for the counter

// loop 2 . Create for loop that loops through gradeArray and adds each value to the variable total.

so at the end is something like this:

average = total / sizeOfArray;

return average;

Explanation / Answer

import java.util.Scanner;


public class AveragingGrades {
    public static void main(String[] args) {
        int size;
        float avg;
        Scanner s = new Scanner(System.in);
        System.out.println("How many grades will you enter?");
        size = s.nextInt();
       
        float gradearr[] = new float[size];
        for(int i=0;i<size;i++){
            gradearr[i] = s.nextInt();
        }
        float sum=0;
        for(int j=0;j<size;j++){
            sum+= gradearr[j];
        }
        avg = sum/gradearr.length;
        System.out.println("Average :" +avg);
    }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote