The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
I cannot get it to display the grade when you enter a value of 0-100. Â The dialogue box keeps looping with no end. Â Please help with my java code below:
import javax.swing.JOptionPane;
public class GradeCalcDiao {
public static void main(String[] args)
{
String strYourGrade;
int NumberofGrades = 0;
int grade = 0;
int min = 100;
int max = 0;
double avg = 0;
int sum = 0;
int high = 0;
int low = 0;
int A,B,C,D,F;
A=0;
B=0;
C=0;
D=0;
F=0;
strYourGrade = JOptionPane.showInputDialog("Enter grades in range of 0 - 100");
while(true){
if(grade != -1){
sum = sum + grade;
}
else if(grade >= 0);
else if(grade >= 90 && gradeÂ
JOptionPane.showMessageDialog(null, "Your grade is A");
}
else if(grade >= 80 && gradeÂ
JOptionPane.showMessageDialog(null, "Your grade is B");
}
else if(grade >= 70 && gradeÂ
JOptionPane.showMessageDialog(null, "Your grade is C");
}
else if(grade >= 60 && gradeÂ
JOptionPane.showMessageDialog(null, "Your grade is D");
}
else if(grade >= 0 && gradeÂ
JOptionPane.showMessageDialog(null, "Your grade is F");
}
else if(grade min = grade;
else if(grade > max)
max = grade;
}
}
}