subject
Engineering, 22.01.2020 04:31 jyepez

In this problem, you’ll play a simple rock, paper, scissors
game. first, you’ll ask the user to pick rock, paper, or
scissors.

then, you’ll have the computer randomly choose one of the
options.

after that, print out the winner! you should keep playing the game until the user hits enter.

note: you’ll need to implement a method called
string getwinner(string user, string computer). luckily,
you just wrote that in an earlier program!

here is a sample run of the program.

enter your choice (rock, paper, or scissors): rock
user: rock
computer: paper
computer wins!
enter your choice (rock, paper, or scissors): paper
user: paper
computer: scissors
computer wins!
enter your choice (rock, paper, or scissors): scissors
user: scissors
computer: paper
user wins!
enter your choice (rock, paper, or scissors): rock
user: rock
computer: rock
tie
enter your choice (rock, paper, or scissors):
for playing!
public class rockpaperscissors extends consoleprogram
{
private static final string user_player = "user wins! ";
private static final string computer_player = "computer wins! ";
private static final string tie = "tie";

private string getwinner(string user, string computer)
{

}

public void run()
{

}
}

ansver
Answers: 1

Other questions on the subject: Engineering

image
Engineering, 03.07.2019 14:10, BardiFan
Amass of m 1.5 kg of steam is contained in a closed rigid container. initially the pressure and temperature of the steam are: p 1.5 mpa and t 240°c (superheated state), respectively. then the temperature drops to t2= 100°c as the result of heat transfer to the surroundings. determine: a) quality of the steam at the end of the process, b) heat transfer with the surroundings. for: p1.5 mpa and t 240°c: enthalpy of superheated vapour is 2900 kj/kg, specific volume of superheated vapour is 0. 1483 m/kg, while for t 100°c: enthalpy of saturated liquid water is 419kj/kg, specific volume of saturated liquid water is 0.001043m/kg, enthalpy of saturated vapour is 2676 kj/kg, specific volume of saturated vapour is 1.672 m/kg and pressure is 0.1 mpa.
Answers: 3
image
Engineering, 04.07.2019 18:10, heidiburgos1own6c0
Fluids at rest possess no flow energy. a)- true b)- false
Answers: 3
image
Engineering, 04.07.2019 18:10, namira16
Which of the following controllers anticipates the future from the slope of errors over time? a)-proportional b)-on/off c)-integral d)-derivative.
Answers: 2
image
Engineering, 04.07.2019 18:20, AnonymousLizard52303
A2-m rigid tank initially contains saturated water vapor at 100 kpa. the tank is connected to a supply line through a valve. steam is flowing in the supply line at 600 kpa and 300 c. the valve is opened, and steam is allowed to enter the tank until the pressure in the tank reaches the line pressure, at which point the valve is closed. a thermometer placed in the tank indicates that the temperature at the final state is 200°c. determine (a) the mass of steam that has entered the tank (b) the amount of heat transfer.
Answers: 3
You know the right answer?
In this problem, you’ll play a simple rock, paper, scissors
game. first, you’ll ask the user t...

Questions in other subjects:

Konu
Mathematics, 02.03.2021 19:30
Konu
Arts, 02.03.2021 19:30
Konu
Mathematics, 02.03.2021 19:30