@@ -0,0 +1,2033 @@
+/*Borhan Sagor%0D%0ACOSC 1336%0D%0Ahi-low game%0D%0Aseparating methods that do not need to be repeated outside of the loop, making a random generator to generate number between 1-100; which will be %0D%0Athe winning number, then making a boolean variable that acts as starting and ending of the loops. finally implementing userinput whether they want to%0D%0Acontinue or end the game.*/%0D%0Aimport java.util.*;%0D%0A%0D%0Apublic class hilow%7B%0D%0A    public static void main(String%5B%5DstrArg)%7B%0D%0A%0D%0A        Scanner scan=new Scanner(System.in);//instantiating methods%0D%0A        Random number=new Random();%0D%0A%0D%0A        %0D%0A%0D%0A        int winningnumber=number.nextInt(100)+1;// winning number between 1-100%0D%0A        %0D%0A        boolean play=true;//boolean to use as switch to end and start loop later on%0D%0A        %0D%0A        while (play)%7B%0D%0A            System.out.println(%22guess the number!%22);%0D%0A            int input=scan.nextInt();%0D%0A            if (input%3Ewinningnumber)%7B%0D%0A                System.out.println(%22too High..%22);%0D%0A                System.out.println(%22play again? Type yes to continue or no to quit...%22);%0D%0A                String input2=scan.next();%0D%0A                if (input2.equalsIgnoreCase(%22no%22))%7B%0D%0A                    play=false;//game ends%0D%0A                %7D%0D%0A            %7Delse if (input%3Cwinningnumber)%7B%0D%0A                System.out.println(%22too low..%22);%0D%0A                System.out.println(%22play again? Type yes to continue or no to quit...%22);%0D%0A                String input2=scan.next();%0D%0A                if (input2.equalsIgnoreCase(%22no%22))%7B%0D%0A                    play=false;//game ends%0D%0A                %7D%0D%0A            %7Delse if(input==winningnumber)%7B%0D%0A                System.out.println(%22you win!%22);%0D%0A                System.out.println(%22play again? Type yes to continue or no to quit...%22);%0D%0A                String input2=scan.next();%0D%0A                if (input2.equalsIgnoreCase(%22no%22))%7B%0D%0A                    play=false;//game ends%0D%0A                %7D%0D%0A                %0D%0A            %7Delse%7B%0D%0A                System.out.println(%22error%22);%0D%0A            %7D    %0D%0A        %7D%0D%0A    %7D%0D%0A%7D

Add files via upload