Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

-Write a program that generates two integers under 100 and prompts the user to e

ID: 3628667 • Letter: #

Question

-Write a program that generates two integers under 100 and prompts the user to enter the sum of these two integers. The program then reports true if the answer is correct, false otherwise.

-Write a program that sorts three integers. The integers are entered from the user and stored in variables num1, num2, and num3, respectively. The program sorts the numbers so that num1 <= num2 <= num3 and print out them in order.

-Write a program that plays the popular rock-paper-scissor game. The program randomly generates a number 0, 1, or 2 representing rock, paper, and scissor. The program prompts the user to enter a number (0, 1, or 2) and displays a message indicating whether the user or the computer wins, or it is a draw.

Explanation / Answer

please rate - thanks

CRAMSTER rule 1 question per post

here are 2

import java.util.*;
public class main
{public static void main(String [] args)
    {Scanner in=new Scanner(System.in);
    int n1,n2,sum;
    n1=(int)(Math.random()*100);
    n2=(int)(Math.random()*100);
    System.out.print("How much is: "+n1+" + "+n2+ "? ");
    sum=in.nextInt();
    if(n1+n2==sum)
         System.out.println("Correct :)");
    else
         System.out.println("Incorrect :(");

        }
}

--------------------------------------

import java.util.*;
public class sort3
{public static void main(String args[])
{int num1,num2,num3,s1,s2,s3;
Scanner in = new Scanner(System.in);
System.out.println("Enter 3 numbers ");
System.out.print("Enter number 1: ");
num1=in.nextInt();
System.out.print("Enter number 2: ");
num2=in.nextInt();
System.out.print("Enter number 3: ");
num3=in.nextInt();
System.out.println("Your 3 numbers are: "+num1+" "+num2+" "+num3);
if(num1<num2)
   {if(num1<num3)
        {s1=num1;        //num1 is smallest
        if(num2<num3)
              {s2=num2;
                s3=num3;
                }
         else
                {s2=num3;
                s3=num2;
                }
            }
       else              //num3 is smallest
           {s1=num3;
            s2=num1;
            s3=num2;
            }
        }
    else               //num2 or num3 smallest
        if(num2<num3)
             {s1=num2;   //num2 smallest
               if(num1<num3)
                    {s2=num1;
                    s3=num3;
                    }
                else
                    {s2=num3;
                    s3=num1;
                    }
                }
            else
                {s1=num3;
                s2=num2;
                s3=num1;
                }
System.out.println("Sorted your 3 numbers are: "+s1+" "+s2+" "+s3);
}
}

-----------------------------------

a rock paper scissor I had laying around

import java.util.*;
    public class rockpaperscissor
   {static String moves[]={"rock","paper","scissors"};
    static Random randomGenerator = new Random();
      public static void main(String[] args)
      {Scanner in = new Scanner(System.in);
    boolean again=true;

   int usermove;
int computermove;
while(again)
   {usermove= user(in);
     computermove=computer();
     score(usermove,computermove);
     again=conclusion(in);
     }

}

public static int user(Scanner in)
{char a;
int move=0;
    System.out.print("Choose your weapon (r,p,s): ");
    a=in.nextLine().charAt(0);
    a=Character.toLowerCase(a);
    while(a!='r'&&a!='p'&&a!='s')
     {System.out.print("Choose your weapon (r,p,s): ");
     a=in.nextLine().charAt(0);
     a=Character.toLowerCase(a);
         }
     switch(a)
       {case 'r': move=0;
                  break;
        case 'p': move=1;
                  break;
        case 's': move=2;
                  break;
        }   
return move;
}

public static int computer()
{int move=randomGenerator.nextInt(3);

System.out.println("I chose "+moves[move]);
return move;
}

public static void score(int user,int computer )
{
if(user==computer)
     System.out.println("Tie!");
else if(user==0&&computer==2)
     System.out.println("You break my sissors. you win!");
else if(user==0&&computer==1)
     System.out.println("I cover your rock. you lose!");
else if(user==1&&computer==2)
     System.out.println("I cut your paper. you lose!");
else if(user==1&&computer==0)
      System.out.println("You cover my rock. you win!");
else if(user==2&&computer==0)
      System.out.println("I break your sissors, you lose!");
else
       System.out.println("You cut my paper. you win!");
return;
}

public static boolean conclusion(Scanner in)
{char a;
System.out.println(" Good game. Play again!(Y/N) ");
a=in.nextLine().charAt(0);
a=Character.toLowerCase(a);
while(a!='y'&&a!='n')
     {System.out.print("invalid entry Play again(Y/N)? ");
     a=in.nextLine().charAt(0);
a=Character.toLowerCase(a);
     }
if(a=='y')
     return true;
else
     return false;
}
}