Question: I need help outputting the average grade as a 2 decimal value (ie 46.62). JAVA using Eclipse import java.util.Scanner; import java.math.RoundingMode; import java.text.DecimalFormat; public class

I need help outputting the average grade as a 2 decimal value (ie 46.62). JAVA using Eclipse

import java.util.Scanner; import java.math.RoundingMode; import java.text.DecimalFormat;

public class assign1 {

public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("enter first grade: "); double g1 = in.nextInt(); System.out.print("enter second grade: "); double g2 = in.nextInt(); System.out.print("enter third grade: "); double g3 = in.nextInt(); System.out.print("enter fourth grade: "); double g4 = in.nextInt(); System.out.print("enter fifth grade: "); double g5 = in.nextInt(); System.out.print("your average grade is: "+ +(g1+ g2+ g3+ g4+ g5)/5); } }

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!