on smashwords, bz boroghina bogdan, java seminar
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package calculatorul.joaca.singur;
import java.util.Scanner;
/**
*
* @author io
*/
//clasa de baza
public class CalculatorulJoacaSingur {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
double x=Math.random();
x=x*10;
boolean ghicit=false;
int nri=0;
int j;
while(ghicit==false&&nri<5)
{
int nr=(int)(x);
Scanner ob=new Scanner(System.in);
int nr1=ob.nextInt();
double nr1=Math.random()*10;
if(nr1==nr)
{
System.out.println("win");
ghicit=true;
}
else
{
System.out.println("lose");
}
nri++;
j=5-nri;
System.out.println("rest: "+j);
}
}
}
Niciun comentariu:
Trimiteți un comentariu
Rețineți: Numai membrii acestui blog pot posta comentarii.