Couldn't find Java bug | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Couldn't find Java bug

import java.util.*; class Grade { private int id; private String name; public int exam_number; private double SCORE = 0; private String GRADE; Grade(int i, String n, int en){ this.id = i; this.name = n; this.exam_number = en; } public void take_exam(){ Scanner sc = new Scanner(System.in); int i = exam_number; while(i>0){ System.out.println("Enter the obtained score"); double val = sc.nextDouble(); if(val<0 || val>100){ System.out.println("Please Enter between and including 0 and 100"); continue; }else{ SCORE += val; } } double average = (SCORE/exam_number); void calc(){ if(average>=0.9){ GRADE = "A"; } else if(average>=0.8){ GRADE = "B"; } else if(average>=0.7){ GRADE = "C"; } else if(average>=0.6){ GRADE = "D"; } else{ GRADE = "F"; } } String gGrade(){ return Grade; } public static void main(String [] args){ Grade Gr = new Grade(12,"Adugna",3);

21st May 2019, 11:20 AM
Adugna.T
Adugna.T - avatar
1 Answer
0
Add all your code in playground to be more readable and attach here the link
21st May 2019, 1:26 PM
Prokopios Poulimenos
Prokopios Poulimenos - avatar