帮我看一下这个程序的错误应该怎么改.
importjavax.swing.*;publicclassChineseGrade{StringscoreString;Stringgrade;doublescore...
import javax.swing.*;
public class ChineseGrade
{
String scoreString;
String grade;
double score;
public ChineseGrade()
{
scoreString=JOptionPane.showInputDialog(null,"输入成绩");
score=Double.parseDouble(scoreString);
if(score>100||score<0)
{
JOptionPane.showMessageDialog(null,"输入信息错误!","结果",JOptionPane.WARNING_MESSAGE);
}
if(score>90)
grade="A";
else if(score>80||score<90)
grade="B";
else if(score>70||score<80)
grade="C";
else if(score>60||score<70)
grade="D";
else if(score<60)
grade="E";
JOptionPane.showMessageDialog(null,grade"学生的成绩等级",JOptionPane.INFORMATION_MESSAGE);
}
public static void main(String args[])
{
ChineseGrade gradeJudge=new ChineseGrade();
System.exit(0);
}
} 展开
public class ChineseGrade
{
String scoreString;
String grade;
double score;
public ChineseGrade()
{
scoreString=JOptionPane.showInputDialog(null,"输入成绩");
score=Double.parseDouble(scoreString);
if(score>100||score<0)
{
JOptionPane.showMessageDialog(null,"输入信息错误!","结果",JOptionPane.WARNING_MESSAGE);
}
if(score>90)
grade="A";
else if(score>80||score<90)
grade="B";
else if(score>70||score<80)
grade="C";
else if(score>60||score<70)
grade="D";
else if(score<60)
grade="E";
JOptionPane.showMessageDialog(null,grade"学生的成绩等级",JOptionPane.INFORMATION_MESSAGE);
}
public static void main(String args[])
{
ChineseGrade gradeJudge=new ChineseGrade();
System.exit(0);
}
} 展开
1个回答
展开全部
import javax.swing.*;
public class ChineseGrade {
String scoreString;
String grade;
double score;
public ChineseGrade() {
scoreString = JOptionPane.showInputDialog(null, "输入成绩");
score = Double.parseDouble(scoreString);
if (score > 100 || score < 0) {
JOptionPane.showMessageDialog(null, "输入信息错误!", "结果",
JOptionPane.WARNING_MESSAGE);
} else {
if (score >= 90)
grade = "A";
else if (score >= 80 &&score < 90)
grade = "B";
else if (score >= 70 && score < 80)
grade = "C";
else if (score >= 60 && score < 70)
grade = "D";
else
grade = "E";
JOptionPane.showMessageDialog(null, "学生的成绩等级:" + grade, "结果",
JOptionPane.INFORMATION_MESSAGE);
}
}
public static void main(String args[]) {
ChineseGrade gradeJudge = new ChineseGrade();
System.exit(0);
}
}
public class ChineseGrade {
String scoreString;
String grade;
double score;
public ChineseGrade() {
scoreString = JOptionPane.showInputDialog(null, "输入成绩");
score = Double.parseDouble(scoreString);
if (score > 100 || score < 0) {
JOptionPane.showMessageDialog(null, "输入信息错误!", "结果",
JOptionPane.WARNING_MESSAGE);
} else {
if (score >= 90)
grade = "A";
else if (score >= 80 &&score < 90)
grade = "B";
else if (score >= 70 && score < 80)
grade = "C";
else if (score >= 60 && score < 70)
grade = "D";
else
grade = "E";
JOptionPane.showMessageDialog(null, "学生的成绩等级:" + grade, "结果",
JOptionPane.INFORMATION_MESSAGE);
}
}
public static void main(String args[]) {
ChineseGrade gradeJudge = new ChineseGrade();
System.exit(0);
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询