August 15, 2022

findmeguilty-themovie

Technology Forever

java – The Pig Dice Video game with the Pc / User … [SOLVED]

I have been doing the job on this system for about a week now and I feel I have it down pack. The problem I am getting when I ask the person at the beginning of the activity (human vs laptop or computer) everytime I operate the program it asks me what my name is once again. Listed here is what I have hence much:

 import java.util.Scanner  

 general public class Assignment  
 {  
     Scanner usersName  
     Boolean humanTurn = legitimate  
     Boolean computerTurn = real  
     int dice  
     int humanTurnPoints, computerTurnPoints  
     int humanTotalPoints = 
     int computerTotalPoints = 
     personal Scanner keyboard
     non-public Scanner critical   

     //Process.out.print("Please enter your title: ")
     //usersName = new Scanner(Technique.in)  
     //setStart(usersName.nextLine())

     community void roll()  
           
         dice = (int)(Math.random()*6) + 1                   
               

     public int humanTurnScore()  
           
               
                 humanTurnPoints = dice + humanTurnPoints  
                 Procedure.out.println("You threw: " + dice)
                 System.out.println("You have scored: " + humanTurnPoints + " in your turn.")  
              return humanTurnPoints  
          
     public void humanTurnZero()
     
        humanTurnPoints = 
      

     general public int computerTurnScore()  
           
               
                 computerTurnPoints = dice + computerTurnPoints  
                 Program.out.println("Computer system has scored: " + computerTurnPoints + " in its transform.")  
              return computerTurnPoints  
              
      public void computerTurnZero()
         
            computerTurnPoints = 
          

     community Assignment()  
       
         humanGame()  
         if(!humanTurn)  
           
             computerTurn()  
           
       
     community int humanGame()
        { 

         Procedure.out.println("To begin the sport remember to push 'r'.")  
         important = new Scanner(Technique.in)  
         String start off = critical.nextLine()  
         if(!get started.equalsIgnoreCase("R")) 
         
                Procedure.out.println("Make guaranteed you are pressing 'r'.")
                humanGame()
         

         if(start.equalsIgnoreCase("R"))
            {                          
                         Program.out.println("You pressed 'r'.")  
                         Program.out.println("Lets start.")           


             do{  
                 roll()    


                 if(dice == 1)  
                   
                     Procedure.out.println("You bought 1 and you shed your transform.")
                     System.out.println("Computer's GRAND Overall score is: " + computerTotalPoints)
                     humanTurnZero()            
                     computerTurn()  

                   
                 else if(dice != 1) 
                 

                     humanTotalPoints += dice  
                        if(humanTotalPoints >= 100)    
                          
                            Process.out.println("You threw: " + dice)
                            System.out.println("Your GRAND Complete score is: " + humanTotalPoints)
                            System.out.println("Congratulations, you get!")  
                            Technique.exit()  
                         
                     humanTurnScore()  
                     Technique.out.println("Your GRAND Total rating is: " + humanTotalPoints)  
                     Process.out.println("Computer's GRAND Overall rating is: " + computerTotalPoints)
                     System.out.println("You can keep or roll once again.")  
                     Program.out.println("To roll again press 'r' or 'h' to hold.")  
                     keyboard = new Scanner(Technique.in)  
                     String preference = keyboard.nextLine()  

                     if(preference.equalsIgnoreCase("R"))                                  
                           
                           System.out.println("You pressed 'r'.")  
                           Technique.out.println("Allows roll again.")   
                           roll()           

                                 if(!selection.equalsIgnoreCase("R"))
                                    
                                        Technique.out.println("You failed to push 'r'. To make confident the method is running accurately you should push 'r' to roll or 'h' to hold.")
                                        humanGame()
                                    
                        

                     if(choice.equalsIgnoreCase("h"))  
                                                  
                         Procedure.out.println("You pressed 'h' and free your convert.")
                         Process.out.println("Your Grand full is: " + humanTotalPoints)
                         humanTurnZero()  
                         computerTurn()  
                              

                      

            }whilst(humanTurn)     

         }return dice  
     }  
 community int computerTurn()  
 {  
     Method.out.println("Now it really is laptop switch.")  

     do   
         roll()  

         if(dice != 1)  
           
             computerTotalPoints += dice 
                if(computerTotalPoints >=100)  
                      
                        System.out.println("Laptop threw: " + dice)
                        Process.out.println("Computer's GRAND Whole rating is: " + computerTotalPoints)
                        Process.out.println("Sport More than! the pc wins")  
                        Process.exit()  
                       
             Method.out.println("Computer system threw: " + dice)
             Procedure.out.println("Computer's GRAND Complete score is: " + computerTotalPoints)
             System.out.println("Your Grand overall is: " + humanTotalPoints)
             computerTurnScore()  
             roll()  
           

         if(dice == 1)   
           
             Technique.out.println("Computer thrown 1 consequently it is really your turn now.")  
             computerTurnZero()  
             humanGame()  
           

         if(computerTurnPoints >= 20)  
           
             Program.out.println("Laptop scored previously " + computerTurnPoints + " you would far better begin to emphasis.")  
             Program.out.println("Remember to perform again")  
             humanGame()  
            

     whilst (computerTurn)  
     return dice  

 }     


 general public static void most important(String[] args)  
   
     new Assignment()  
   
 }  

I commented out (up close to the top rated of the method) exactly where I am inquiring the person at the commencing of the plan what their title is. I really have to have in all the Procedure.out.println wherever it states ‘You’ I need it to say the usersName.

Would anyone make sure you aid me with this program. I know an individual is form adequate to aid me out here.

Thank you in advance.