خرید بک لینک

Vote count: 0

import java.util.Scaer; import java.util.Random;

   public class ResponseTimeProject
    {
       public static void main(String[] args)
        {


          Scaer in = new Scaer(System.in);
          Random rand = new Random();

          System.out.print("Please enter your full name: ");
          String name = in.nextLine();

          System.out.println("Hello " + name 
           + ". Please answer as fast as you can."
           + "Hit <ENTER> when ready for the question.");
           in.nextLine();

       for (int count = 0; count < 4; count ++)


       {

         String alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

         int character=(int)(Math.random()*26);

         String s = alphabet.substring(character, character+1);

         Random r = new Random();
         int i;

        for (i = 0; i < 1; i++) 
     {
         System.out.println(alphabet.charAt(r.nextInt(alphabet.length())));

} 


  long startTime = System.currentTimeMillis();

  System.out.print("What is the next letter in the alphabet?" + " ");
  String response = in.nextLine();     


 long endTime = System.currentTimeMillis();


     String outcome;

         if (alphabet.substring(character+1, character+2).equals(response))
   {  
     outcome = "Correct!";
    }else {
    outcome = "Incorrect.";
   }

      long reactionTime = endTime - startTime;

      System.out.println(outcome);


          System.out.println("The average time it took you was " + reactionTime + " milliseconds");


           System.out.println("Thank you "  + name + ", goodbye.");

       }
    }

}

HELP: This code runs but it gives me the wrong answer. I do not know what is wrong. It prints incorrect for the right outcome. Not sure what i need to fix

asked 33 secs ago

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 12 فروردين 1395 ساعت: 7:36

صفحه بندی