60 627
Assignments Done
Successfully Done
In April 2018

Answer to Question #12189 in C# for Cherry blossom

Question #12189
In the game of scissors, paper, stone (or Jack N Poy or Pick) each of two players choose either scissors (code X),paper (code P) or stone (code S). If one chooses scissors and the other chooses stone then paper wins. If one chooses paper and the other scissors then scissors wins. If they both chooses the same then the result is tie. Read in two character codes corresponding to the object selected and then output either message ‘PLAYER 1 WINS’, ‘PLAYER 2 WINS’ or ‘TIE’. Use the output format below:
PLAYER 1 ENTER :<value and not code>
PLAYER 2 ENTER:<value and not code>

RESULT :<result>
Expert's answer
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
class Program
& static void Main(string[] args)
& {
string again;
Console.WriteLine("Enter symbol for first player (scissors (code X),paper (code P) or stone (code S)):");
string player1, player2;
player1 = Console.ReadLine();
Console.WriteLine("Enter symbol for second player (scissors (code X),paper (code P) or stone (code S)):");
player2 = Console.ReadLine();
if (player2 == player1)
& Console.WriteLine("TIE");
else if ((player1 == "S" || player1 == "s") && (player2 == "X" || player2 == "x") ||
& (player1 == "X" || player1 == "x") && (player2 == "P" || player2 == "p") ||
& (player1 == "P" || player1 == "p") && (player2 == "S" || player2 == "s"))
& Console.WriteLine("player number one win!");
& Console.WriteLine("player number two win!");
Console.WriteLine("Do you want play again? enter Y");
again = Console.ReadLine();
} while (again == "Y" || again == "y");

& }

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions