I'm trying to figure out the code to make a bowling scorekeeper in Java and I'm having trouble making it so that the user can input more than one strike or spare in a row. If you have any tips please let me know! thanks :) clarification edit: so the question for the code was to make a program that lets the user input the number of pins knocked down in one round of bowling with 10 frames. So far, i have the code set up so that it takes the number of pins that the user inputted and adds that to the score. I also have it set up so that the user can input only one strike or spare in a row (since those require information from the next frame). The issue that i am having is if the bowler bowls two strikes or spares in a row, or even all spares
import java.util.Scanner;
public class Bowlers {
public static void main (String [] args) {
Scanner s = new Scanner(System.in);
System.out.println("this is a bowling score keeper :)");
System.out.println("if you roll a strike enter 0 when prompted for roll 2 :)");
System.out.println("please dont have two fancy things in a row");
int roll1[] = new int[11];
int roll2[] = new int[11];
int roll3[] = new int [1];
int score = 0;
for (int i = 0; i <10; i++) {
System.out.print("enter roll 1 score: ");
roll1[i]=s.nextInt();
score = score+roll1[i];
System.out.print("enter roll 2 score: ");
roll2[i] = s.nextInt();
score = score +roll2[i];
if (roll1[9] == 10) {
System.out.print("enter roll 3 score: ");
roll3[0] = s.nextInt();
score = score + + roll2[9] + roll3[0];
}
else if (roll1[i] + roll2[i] == 10) {
score = score + roll1[i+1] +1;
}
else if (roll1[i] == 10) {
score = score + roll1[i+1] + roll2[i+1] +1;
}
}
System.out.println(score);
//ending curlies below
}
}