Coders Packet

Coin Game Using Java

By Rajesh Kolipaka

It is a simple game. In this Coin Game, the user guesses whether a flipped coin is head or tail.

Programming Language used: JAVA

 Aim of the program:

 Let the user guess whether a flipped coin is head or tail.

Functionality:

-->System will randomly generate an integer either 1 or 2 which represents head or tail.

-->The program prompts the user to enter a guess.

-->Reports the user whether WIN or LOSE if the guess is correct or wrong respectively.

-->Repeat the game until the user ends.

 About classes in the packet :

 Our code contains only a single class called "Main".

Note: We have import Random module from util package i.e. import java.util.Random;

 

Output:

code ourput

Download Complete Code

Comments

No comments yet