Dear All

I am facing a compile time error in the java code mentioned below

class Scorecard
{

        public int score(int *pinCount)
        {
                int rollIndex = 0;
                int total = 0;
                for (int frame = 0; frame < 10; frame++)
                {
                        if (strike(rollIndex))
                        {
                                total += 10 + pinCount(rollIndex + 1) + 
pinCount(rollIndex + 2);
                                rollIndex++;
                        }
                        else if (spare(rollIndex))
                        {
                                total += 10 + pinCount(rollIndex + 2);
                                rollIndex += 2;
                        }
                        else
                        {
                                total += pinCount(rollIndex) + 
pinCount(rollIndex + 1);
                                rollIndex += 2;
                        }
                }
                return total;
        }

        private boolean strike(int rollIndex)
        {
                return pinCount(rollIndex) == 10;
        }

        private boolean spare(int rollIndex)
        {
                return pinCount(rollIndex) + pinCount(rollIndex + 1) == 10;
        }



        public static void main(String[] args)
        {
                int pinCount[] = {10, 10 , 10 , 10 , 10 , 10 , 10 , 10 , 10 , 
10 };
                int totalScore;

                totalScore = score (pinCount);

                System.out.println("Total Score is: " + totalScore);

        }
}





Please help in correcting the code
Thanks in advance.

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en

Reply via email to