Severity: Warning
Message: fopen(/tmp/ci_sessiont30vk1qvosnrrg286d1cg9gnqfuh7rvd): failed to open stream: No space left on device
Filename: drivers/Session_files_driver.php
Line Number: 176
Backtrace:
File: /var/www/html/application/controllers/Project.php
Line: 10
Function: __construct
File: /var/www/html/index.php
Line: 311
Function: require_once
Severity: Warning
Message: session_start(): Failed to read session data: user (path: /tmp)
Filename: Session/Session.php
Line Number: 143
Backtrace:
File: /var/www/html/application/controllers/Project.php
Line: 10
Function: __construct
File: /var/www/html/index.php
Line: 311
Function: require_once
It is a simple game . In this game , the user chooses a choice of Rock or Paper or Scissors to compete with System.
Programming Language used: JAVA
Aim of the program:
Let the user choose a choice of Rock or Paper or Scissors to play with the System.
Functionality:
-->System will randomly generate an integer either 1 or 2 or 3 which represents Rock, Paper, and Scissors respectively.
-->The program prompts the user to enter a choice.
-->Reports the user whether WIN or LOSE or DRAW based on choices of both User and System.
-->Repeat the game until the user ends.
About classes in the packet :
Our code contains two classes:
1) Rock_Paper_Scissors_game
2) Main
Rock_Paper_Scissors_game class:
This class contains two methods:
1) game(): It is the important method in our packet because it contains most of the rock-paper-scissors game code.
2) display(): It is used to display the choice chosen by the System and User.
Main class:
In this class we will create an object to the Rock_Paper_Scissors_game class and using that object we will call the game() method.
Note: In our program, we have import Random module from the util package i.e. import java.util.Random;
Output:
Submitted by Rajesh Kolipaka (Rajesh)
Download packets of source code on Coders Packet
Comments