What should I do to run each element of my string array in my askQuizQuestion method?
It's a simple quiz but I'm lost on out to initialize each element of the array into my askQuizQuestion method.
Each use response is either a yes or no. If yes then +1 to a running count and after the last question the total count is returned to the printSurveyResults method to determine which response to print out.
public class Quiz {
public static void printSurveyResults(int answerCount)
{
if (answerCount >= 0 && answerCount <= 2)
{System.out.println ("You are more exhausted than stressed out.");}
else if (answerCount >= 3 && answerCount <= 5)
{System.out.println ("You are beginning to stress out.");}
else if (answerCount >= 6 && answerCount <= 8)
{System.out.println ("You are possibly stressed out.");}
else if (answerCount >= 9 && answerCount <= 12)
{System.out.println ("You are probably stressed out.");}
}
public static int askQuizQuestion(String prompt, Scanner keyboard)
{
int count = 0;
int i;
for (i = 0; i < 12; i++);
System.out.println(prompt);
if (keyboard.equals("yes"))
{count++;}
printSurveyResults(count);
}
public static void main(String[] args)
{
String[] question = new String[12];
question [0] = "I find myself less eager to go back to work or to resume my chores after a weekend.";
question [1] = "I feel less and less patient and/or sympathetic listening to other people’s problems.";
question [2] = "I ask more “closed-ended questions to discourage dialogue with friends and co-workers than “open-ended” ones to encourage it.";
question [3] = "I try to get away from people as soon as I can.";
question [4] = "My dedication to work, exercise, diet, and friendships is waning.";
question [5] = "I am falling further behind in many of the responsibilities in my life.";
question [6] = "I am losing my sense of humor.";
question [7] = "I find it more and more difficult to see people socially.";
question [8] = "I feel tired most of the time.";
question [9] = "I don’t seem to have much fun anymore.";
question [10] = "I feel trapped. ";
question [11] = "I know what will make me feel better, but I just can’t push myself to do it and I’ll “Yes, but” any suggestions that people make.";
}
}