-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaccenture_26.java
More file actions
31 lines (27 loc) · 876 Bytes
/
Copy pathaccenture_26.java
File metadata and controls
31 lines (27 loc) · 876 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
Rock, Paper, Scissors
Two players A and B, are playing the game of Rock, Paper, Scissors. Player A chooses a move represented by a string value M; and the move can be one of the following 'rock', 'paper', or 'scissors' where.
-rock beats scissors
-scissors beats paper
-paper beats rock
your task is to find and return a string value representing the wining move for player B.
output is case sensitive
input
*/
import java.util.*;
public class accenture_26 {
static String check(String M){
if(M.equals("rock"))
return "paper";
else if(M.equals("paper"))
return "scissor";
else
return "rock";
}
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
String M=sc.nextLine();
sc.close();
System.out.println(check(M));
}
}