Write a findwinner method that takes in two moves

Assignment Help Computer Engineering
Reference no: EM132076123

I need some help on my java project, this is just a part of it. **When you answer this question please follow the instructions.**

Write a JAVA class (Rock, Paper, Scissors Game) that represents the game.

This class only represents the game.

This class does not interact with the user at all.

The RPSGame object is described by three characteristics. These are the instance data variables:

number of computer wins

number of user wins

number of ties

Include appropriate getters and setters.

Include constants or an enum to represent the possible moves (rock, paper, or scissors) and the possible outcomes of a single round (user win, computer win, or tie).

Use these constants/enum to make your code more readable.

For example, if you are using ints to store the moves, it's more clear to test whether userMove==ROCK or userMove==Moves.ROCK rather than userMove==1.

If you don't use an enum, you can decide what type of data to use for the constants (String, int, or something else).

Write a generateComputerPlay method that generates a random move by the computer.

Write a findWinner method that takes in two moves as parameters (the user move and the computer move) and determines the outcome (user wins, computer wins, or tie).

Determining the winner will require you to compare a lot of possible match-ups through a series of nested conditionals.

The method should update the instance data (number of computer wins, number of user wins, and number of ties) depending on the outcome.

Reference no: EM132076123

Questions Cloud

Calculate new dimensions for the textdraw panel : Calculate and save the difference between the two in both the height and width dimensions.
Create an array that holds hundred integers : Write a complete method (including a full method header) called contains.Create an array that holds 100 integers
Find values for the parameters a and p : a. Find values for the parameters a and P. b. State the initial quantity and the percent rate of growth or decay.
Find the indicated probability : Suppose that X has a normal distribution. Find the indicated probability. The mean is 15.2 and the standard deviation is 0.9. Find the probability that X is gre
Write a findwinner method that takes in two moves : Determining the winner will require you to compare a lot of possible match-ups through a series of nested conditionals.
Determine its radius r and length h if the trough : Determine its radius r and length h if the trough is to require the least material for its construction.
Write a program that implements and tests of two functions : Write a c++ program that implements and tests the following two functions related to the Calkin-Wilf enumeration of the positive fractions.
What is the length of the diameter : 1. Points (-7, 6) and (3,8) are endpoints of the diameter of a circle. A. What is the length of the diameter (simplify)
How many noninverting buffers would be required : If this memory were expanded to 16 4-bit word how many inverting buffers (NOT gates) would be required?

Reviews

Write a Review

Computer Engineering Questions & Answers

  Can we ever have too much technology

What are some of the obstacles that must be overcome before humans are likely to accept social robots in their lives?If that ever happens, what ethical issues might arise and need to be resolved

  Questioninformation representationa security camera in an

questioninformation representationa security camera in an office building has 1000 x 1000 pixels. each pixel shows a

  1 construct a truth table for the following boolean

1. construct a truth table for the following boolean expressionsa abc abcb abc abc abcc abc bc2. simplify the

  Express each deal in prefix and explict notation

Express each deal in prefix, explict and Exponential (ie. Scientific) notation as a cost per byte and per bit.

  Suggest an efficient representation for your abstract type

Suggest an efficient representation for your abstract type. Use any suitable programming language.

  Examine the new system and find out the design issues with

a large fast-food chain unveiled a new touch screen register for its franchises. each cashier was assigned a user id

  How many students were taking just one or just two units

How many individual/unique students are in the file? How many students were taking just one or just two units? Which unit had the largest enrolment?

  What can go wrong in bisection

Vectorize MySqrt so that it can handle the case when A is a matrix of nonnegative numbers.

  Obtain eight bit planes for the sena

Use the function extrctb p to obtain eight bit planes for the sena . img and omaha. img test images, and encode them using arithmetic coding. Use the low-resolution contexts shown in given Figure.

  Discuss a programming language to develop secure software

Write a ½ page memo that explains factors to consider when selecting a programming language to develop secure software

  Visual logic

Consider that you are working with “Visual Logic”. Develop the logic for a program which enables a user to enter the 10 numbers, and then display them in reverse order of their entry.

  Find the deciphering map and then decipher the message

MA3626 - Find the number of possible encryption exponents and Find the deciphering map and then decipher the message - Find the largest possible value

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd