Make a program that asks the user for his/her scores in the 3 exams(integer) out
ID: 3615472 • Letter: M
Question
Make a program that asks the user for his/her scores in the 3 exams(integer) out of 100. Then computes for the average of the 3 exams(double). And lastly, tells the user if he/she passed or failed.The user passes if his/her average score is 60 and above otherwisehe/she fails.Sample output:
enter score in exam 1: 80
enter score in exam 2: 90
enter score in exam 3: 100
average score of the 3 exams: 90
pass
Explanation / Answer
please rate - thanks import java.util.*; public class untitled {public static void main(String[] args) {double avg; double g1,g2,g3; Scanner in=new Scanner(System.in); System.out.print("enter score in exam 1: "); g1=in.nextDouble(); System.out.print("enter score in exam 2: "); g2=in.nextDouble(); System.out.print("enter score in exam 3: "); g3=in.nextDouble(); avg=(g1+g2+g3)/3.; System.out.println("average score of the 3exams: "+avg); if(avg>=60.) System.out.println("pass"); else System.out.println("fail"); } }
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.