66 909
Assignments Done
99,1%
Successfully Done
In October 2018

Answer to Question #2683 in Java | JSP | JSF for hari

Question #2683
Write a program to accept marks in 4 subjects, find the average and display the grades. < 50 – F, < 60 – A, < 70 –B, < 85 – C, > 85 –S
Expert's answer
import java.util.*;

public class Marks {
public static void mark() {
& int[] mark = new int[4];
& float sum = 0;
& Scanner scan = new Scanner(System.in);
& for (int i = 0; i < 4; i++) {
& System.out.println("enter " + (i + 1) + " mark");
& mark[i] = scan.nextInt();
& sum += mark[i];
& }
& System.out.println("average is: " + sum / 4);
& for (int i = 0; i < 4; i++) {
& if (mark[i] < 50)
& System.out.println("F");
& else if (mark[i] < 60)
& System.out.println("A");
& else if (mark[i] < 70)
& System.out.println("B");
& else if (mark[i] < 85)
& System.out.println("C");
& else if (mark[i] >= 85)
& System.out.println("S");
& }

}

public static void main(String[] args) {
& mark();
}
}

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

jera
01.08.13, 14:15

how to create a program that will accept subjects , grades and displays the average

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions