The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Jul 2017 |
| Last Sign in: | 305 Weeks Ago, 1 Day Ago |
| Questions Answered: | 15833 |
| Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
Hello,
I am trying to write a rock paper scissors game. In one of my If statements I have an else statement for if the computer wins. I can't seem to get the computer to win. Can you Help me with my code? Also I want them to replay the game when it is a tie but everytime its a tie it says I win. If you could help with those question I would appreciate it.Êþº¾ 4 ‰
( L M N O
P Q
L R N S T
U V W
X Y
Z [ \
] ^ _ `
U a b
L c
d e
f
g h i j k l m n
o p q r s t <init> ()V Code LineNumberTable LocalVariableTable this LMission05; main ([Ljava/lang/String;)V i I args [Ljava/lang/String; in Ljava/util/Scanner; r Ljava/util/Random; userPick Ljava/lang/String; numGames userWins userInput cpuWins cpuInput isRock Z isPaper
isScissors
StackMapTable 5 M Q u
SourceFile Mission05.java ) * java/util/Scanner v 6 w ) x java/util/Random y z *Welcome to the Rock, Paper, Scissors Game. { | } &How many games would you like to play? ~ /Invalid Selection. Games must be odd. Try again € Pick Rock, Paper, or Scissors?: Rock u ‚ ƒ Paper Scissors | * java/lang/StringBuilder Sorry, " „ … " . Try again. † ~ ‡ Computer picked Rock Computer picked Paper Computer picked Scissors You win!
Computer won!
It was a tie! User Wins: „ ˆ Computer Wins:
User Wins! Computer Wins! Mission05 java/lang/Object java/lang/String java/lang/System Ljava/io/InputStream; (Ljava/io/InputStream;)V out Ljava/io/PrintStream; java/io/PrintStream println (Ljava/lang/String;)V nextInt ()I nextLine ()Ljava/lang/String; equalsIgnoreCase (Ljava/lang/String;)Z append -(Ljava/lang/String;)Ljava/lang/StringBuilder; toString (I)I (I)Ljava/lang/StringBuilder; ! ' ( ) * + / *· ± , - . / 0 1 + ƒ
Ò» Y² · L» Y· MN666666 6
6² ¶
² ¶
+¶ 6pš ²
¶
+¶ 6§ÿë+¶ W6£² ¶
+¶ N-¶ š A-¶ š 8-¶ š /² ¶ ² » Y· ¶ -¶ ¶ ¶ ¶
+¶ N§ÿ¼,¶ `6 6 ² ¶
6
² ¶
6² ¶
-¶ ™ š -¶ ™ š -¶ ™
™ ² ¶
„² ¶ § ² ¶
„-¶ ™ Ÿ !-¶ ™
Ÿ -¶ ™ ² !¶
„§þè² » Y· "¶ ¶ #¶ ¶
² » Y· $¶ ¶ #¶ ¶
¤ ² %¶
¤ ² &¶
± , Ö 5
" % ( + . 6 > D K S \ a ! k $ s % x * “ - ™ . · / ¿ 4 È 5 Î 7 Ñ 8 Ù : ß < â = ê ? ð A ó B û G H% J- K0 M9 RA SD Ve Wq [y ! b™ c³ dº f hÉ kÑ o - „
d 2 3 Ò 4 5 Ç 6 7 ¿ 8 9 ¼ : ; ¹ < 3 ¶ = 3 ³ > 3 "° ? 3 % @ 3 (ª A B +§ C B
.¤ D B E 9 ÿ D F G H I ü û F
ú û B J K
----------- ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly