通过JAVA编程通过计分表查找高尔夫得分
因此,我编写了这段代码,但无法找出为什么它会给我一个错误,因为我没有定义“I”。我认为我创建的循环中有。此外,它还说我在代码末尾的“搜索结果”未定义。有什么帮助吗通过JAVA编程通过计分表查找高尔夫得分,java,xcode,Java,Xcode,因此,我编写了这段代码,但无法找出为什么它会给我一个错误,因为我没有定义“I”。我认为我创建的循环中有。此外,它还说我在代码末尾的“搜索结果”未定义。有什么帮助吗 import java.io.*; import java.text.*; import java.util.Scanner; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; public cla
import java.io.*;
import java.text.*;
import java.util.Scanner;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class golf_tally
{
public static void main(String[] args) throws IOException
{
Scanner m = new Scanner(System.in);
Scanner q = new Scanner(System.in);
BufferedReader input = new BufferedReader(newInputStreamReader(System.in));
System.out.print("How many holes did you play?");
int h = m.nextInt();
int hArray[] = new int[h];
int pArray[] = new int[h];
int hpArray[] = new int[h];
System.out.print("\nHole Pars");
for(int i = 0, i < h, i++)
{
System.out.print("\nWhat is par for hole " + (i+1) + "? ");
hArray[i] = m.nextInt();
}
System.out.print("\n\You Scores");
for (int i=0, i < h, i++)
{
System.out.print("\n\nWhat did you shoot on hole " + (i+1) + "? ");
pArray[i]= m.nextInt();
}
System.out.print("\n\n--------------------");
System.out.print("\n\nYour scoring summary includes:");
score_result = pArray[i] - hArray[i];
System.out.print(score_result);
int holeInOneCount = 0;
int doubleEagleCount = 0;
int EagleCount = 0;
if(pArray[i] == 1)
{
holeInOneCount++;
}
if(hpArray[i] == -3)
{
doubleEagleCount++;
}
if(hpArray[i] == -2)
{
EagleCount++;
}
}
}
newInputStreamReaderSystem.in应为new InputStreamReaderSystem.in
对于int i=0,i