我收到一个错误,说令牌“;”上的语法错误,这是预期的。我在做什么错或我错过了什么,错误来自字符串输入字符串。我试图创建我可以输入学生成绩的地方,然后将成绩平均在一起,所以我不确定我是否做得对。请帮忙!!!关于如何做到这一点的任何想法?帮助将不胜感激。
import java.util.Scanner; //To hold the users score
import javax.swing.JOptionPane; //For better style
import java.text.DecimalFormat; //needed to format the Output
public class TestScore
{//begin class
public static void main(String[] args)
{//Begin main method
//create the variables
String inputString ; // For reader's input
DoubleScore1, //Define DoubleScore 1
DoubleScore2, //Define DoubleScore 2
DoubleScore3, //Define DoubleScore 3
AverageScore; //Define AverageScore
Scanner keyboard = new Scanner(System.in); //To hold the users grade
DecimalFormat formatter = new DecimalFormat("#,##0.00"); //format the scores
//create keyboard for input
Scanner Keyboard = new Scanner(System.in);
//Ask the user to input DoubleScore1
inputString=
JOptionPane.showInputDialog("Please enter test score 1");
// Convert the input to a double.
DoubleScore1 = Double.parseDouble(inputString);
//Ask the user to input DoubleScore
inputString=
JOptionPane.showInputDialog("Please enter test score 2");
// Convert the input to a double
DoubleScore2 = Double.parseDouble(inputString);
//Ask the user to input DoubleScore
inputString=
JOptionPane.showInputDialog("Please enter test score 3");
// Convert the input to a double
DoubleScore3 = Double.parseDouble(inputString);
//Calculate the average score for the tests
AverageScore = ((DoubleScore1 + DoubleScore2 + DoubleScore3)/3);
//Display Average test Score
JOptionPane.showMessageDialog(null, "\t\nYour Double Score 1 is : " +formatter.format(DoubleScore1)
+ "\t\nYour Double Score 2 is : " +formatter.format(DoubleScore2)
+ "\t\nYour Double Score 3 is : " +formatter.format(DoubleScore3)
+ "\t\nYour Average Score is: " + formatter.format(AverageScore));
//End the program.
System.exit(0);
}//End main method
}//end class`enter code here`