Question

# Design the following game using a function in R studio: 1-The user input a number between...

Design the following game using a function in R studio:

1-The user input a number between 1-12:

2- Then the computer generates a number between (1-12)

3- Then: If the number generated by the computer is less than that of the user, then the user wins.

If the number that is generated by the computer is greater than that of the user, then the computer wins.

If the numbers generated by the user and computer are the same, then it is a super win for the user!

import java.util.*;
public class Game {

public static void main(String[] args)
{
Random rnum = new Random(); //reference to Random no.
int SysRandomNumber = rnum.nextInt(12); //Random no. generated by system
Scanner sc= new Scanner(System.in);
System.out.println("");
System.out.println("W E L C O M E T O G A M E " + UserName);
System.out.println("");
System.out.print(UserName+ " Please Enter the number between (1-12):- ");
int UserRandomNumber= sc.nextInt(); //Number enter by User
System.out.println("");
if(UserRandomNumber > 0 && UserRandomNumber <= 12) //Verify user enter number between (1-12)
{
if(SysRandomNumber == UserRandomNumber) //if statement for Super win
{
System.out.println("C O N G R A T U L A T I O N " + UserName + " S u p p e r w i n t o Y o u ! !");
}
else if (UserRandomNumber > SysRandomNumber)  //if statement for User win
{
System.out.println("C O N G R A T U L A T I O N " + UserName + " Y o u w i n ! !");
}
else if (SysRandomNumber > UserRandomNumber)  //if statement for System win
{
System.out.println("S O R R Y " + UserName + " Y o u L O O S E ! !");
}
}
else {
System.out.println(UserName+" Y o u E N T E R W R O N G V A L U E");
}

}

}