Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment #7: Rock Paper Scissors Summary: Create the Rock Paper Scissors program. The solution file should be named RPS_ExerciseE.rb. Use the instructions on page 290

Assignment #7: Rock Paper Scissors

Summary: Create the Rock Paper Scissors program.

The solution file should be named RPS_ExerciseE.rb.

Use the instructions on page 290 of the textbook.

Run your program until it works and the output looks nice.

Add the necessary documentation as described in Course Documents, and then attach your .rb file to this assignment.image text in transcribed

290 CHAPTER 8 Object-oriented Programming 17. A(n) variable's scope is accessible to all instances of the same class a. Local b. Global C. Instance Class 18. The d method determines whether a variabie exists, returning a value of true if the variable is found. 19. Using the method, you can reverse the onder in which arrays are retrieved. 20. s a keyword that can be used as a shorthand a way of referring to the current object. Reinforcement Exercises The following exercises are designed to further your understanding of Ruby programming by challenging you to make improvements tothe chapters game project, the Rock, Paper, Scissors game. 1. Currently, the Game class's get player move method uses a regular expression to validate the player's moves of Rock. Paper, or Scissors, rejecting any input other than one of these words. Making the player enter entire words takes time and can lead to typos, however. Simplify game play by modifying the get player move method to also allow single- character input in the form of R, P, and S. Make sure you accommodate both uppercase and lowercase input. 2. The game allows players to play an unlimited number of times. To help them keep track of how many times they have played, modify the game by adding a global variable named Sgamecount at the beginning of the program's Main Script Logic area, assigning it an initial value of 0. Next add a method named game count and set it to increment the value of sgamecoun t each time it is executed. Lastly, add a statement to the play game method that executes the

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Datacasting How To Stream Databases Over The Internet

Authors: Jessica Keyes

1st Edition

007034678X, 978-0070346789

More Books

Students also viewed these Databases questions