Answer to Question #44773 in Java | JSP | JSF for cokie

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).
1
Expert's answer
2014-08-08T13:08:22-0400
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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS