RockPaperScissors - /* / RockPaperScissors.java Author:...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
//******************************************************************** // RockPaperScissors.java Author: Lewis and Loftus // // Solution to Programming Project 3.16 //******************************************************************** / import java.util.Scanner; i public class RockPaperScissors { //----------------------------------------------------------------- // Plays the Rock-Paper-Scissors game with the user. //----------------------------------------------------------------- public static void main (String[] args) { final int OPTIONS = 3; final int ROCK = 1, PAPER = 2, SCISSORS = 3; final int COMPUTER = 1, PLAYER = 2, TIE = 3; int computer, player, winner = 0; int wins = 0, losses = 0, ties = 0; String again; Scanner sc = new Scanner(System.in); do { computer = (int) (Math.random() * OPTIONS) + 1; System.out.println(); System.out.print ("Enter your choice - 1 for Rock, 2 for " + "Paper, and 3 for Scissors: "); player = Integer.parseInt (sc.nextLine()); System.out.print ("My choice was ");
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/17/2011 for the course COP 3530 taught by Professor Davis during the Spring '08 term at University of Florida.

Page1 / 2

RockPaperScissors - /* / RockPaperScissors.java Author:...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online