Question #44773

write a program where the user will input their respective subject and grades after that it will compute and display their gwa(general average).

Expert's answer

import java.util.Scanner;public class Main { /** * Main method */ public static void main(String[] args) { //Scanner for keyboard Scanner input =new Scanner(System.in); //prompt user to enter subject System.out.print("Enter respective subject: "); //read subject String subject=input.nextLine(); //total grade double gradeSum=0; for(int i=0;i<10;i++){ System.out.print("Enter grade "+(i+1)+": "); gradeSum+=input.nextDouble(); } //calculate grade Sum double gwa=gradeSum/10; //display their gwa(general average). System.out.print("General average for subject "+subject+" is: "+gwa); }}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS