Write a program that takes in 6 exam scores (numbers) from the command line. For
ID: 3638306 • Letter: W
Question
Write a program that takes in 6 exam scores (numbers) from the command line. For each of these exam scores, print out the grade achieved (1.1 if >= 70, 2.1 if < 70 but >= 60, 2.2 if < 60 but >= 50, pass if < 50 but >= 40 and fail if < 40). The program should also calculate the overall average score and print both this and the grade achieved to the command line.b) Amend the program you wrote for part a) to employ a method to print out the grade achieved based on a supplied exam score.
Explanation / Answer
import java.util.*; class score { public static void main (String arg[]) { Scanner in=new Scanner (System.in); int i,sum=0; float a; int[] subjectmarks; subjectmarks = new int[5]; System.out.print (" Enter mark one by Grade is 1.1 "); else if(subjectmarks=60) System.out.print (" Grade is 2.1 "); else if(subjectmarks=50) System.out.print (" Grade is 2.1 "); else if(subjectmarks=40) System.out.print (" Grade is PASS "); else System.out.print (" Grade is FAIL "); sum=sum+subjectmarks[i]; } avg=(sum)/6; System.out.print (" AVG. is " + avg); if(avg>=70) System.out.print (" AVG. Grade is 1.1 "); else if(avg=60) System.out.print (" AVG. Grade is 2.1 "); else if(avg=50) System.out.print (" AVG. Grade is 2.1 "); else if(avg=40) System.out.print (" AVG. Grade is PASS "); else System.out.print (" AVG. Grade is FAIL "); } }Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.