welcome
JAVA Simple Dice Game
Roll no. Name
36 Shridhar suresh Patil
22 Prajwal Krushnat Sarnobat
16 Pravin Pralhad patil
Project Guide
Prof. Pranoti Tamgave mam
DEPARTMENT OF INFORMATION TECHNOLOGY
DR. J.J. MAGDUM COLLEGE OF ENGINEERING, JAYSINGPUR
Index:
1. Acknowledgement.
2. Introduction.
3. Program.
4. Output.
5. Information
6. Conclusion
ACKNOWLEDGEMENT
We find very happy in submitting project report
on “DICE GAME”. It is mostly impossible to
succeed alone. We are thankful for inspiration and
helpby our guide prof. Pranoti Tamgave mam.
(information Technology).he provided us valuable
advice and suggestions.
INTRODUCTION
Dice game are very much popular in the world and the board games of dice are also very much
popular. So here we created a simple Dice Game where you and Computer will have the battle
against you. In this program there is no need to put any input just run every time and get
output.
The program is made with “[Link]” for generating random number or picking up
random inputs from the program
. We are using Switch statement and IF statement in the program.
The result or output is very easy to understand there will be win, lose and draw. The output
will show the Dice value you got and the Dice value computer get and whose value is higher
will win the game and if equal then draw will be made.
Program:
import [Link];
public class Program
{
public static void six(){
[Link]("---------\n| * * |\n| * * |\n| * * |\n---------");
}
public static void five(){
[Link]("---------\n| * * |\n| * |\n| * * |\n---------");
}
public static void four(){
[Link]("---------\n| * * |\n| |\n| * * |\n---------");
}
}
public static void three(){
[Link]("---------\n| * |\n| * |\n| * |\n---------");
}
public static void two(){
[Link]("---------\n| * |\n| |\n| * |\n---------");
}
public static void one(){
[Link]("---------\n| |\n| * |\n| |\n---------");
}
public static int random(){
Random r = new Random();
int a = [Link](6)+1;
return a;
}
public static void main(String[] args) {
int you = random();
int computer = random();
[Link]("you");
switch(you){
case 1: one(); break;
case 2: two(); break;
case 3: three(); break;
case 4: four(); break;
case 5: five(); break;
case 6: six(); break;
}
[Link]("\n");
[Link]("computer");
switch(computer){
case 1: one(); break;
case 2: two(); break;
case 3: three(); break;
case 4: four(); break;
case 5: five(); break;
case 6: six(); break;
}
if(you>computer){
[Link]("\nLucky! you won. \n :)");
}
if(computer>you){
[Link]("\nYou lost :( \n :)");
}
if(you==computer){
[Link]("\nDraw! click run button again");
}
}
}
Output:
INFORMATION
• Here we are building a simple and fun dice game through java.
• We are using “[Link]” class to generate random numbers.
• We created a dice pattern and the Dice value as well.
• We will using “switch statement” and “if statement” in the program.
• There is no need to input some value, just run and play the game.
Conclusion:
• We successfully created a simple dice game using java.
• Learned to use switch statement and If statement.
THANK YOU!