import java.util.*;
import javax.swing.JOptionPane;
import java.text.*;

class playGames{

public static void main (String [] args){

	Fermi fermi;
	fermi = new Fermi();

  int num1 =fermi.fermi1();
  int num2 = fermi.fermi2();
  int num3 = fermi.fermi3();



	boolean playGame = true;

	int firstGuess;

	int secondGuess;

	int thirdGuess;



		String inputStr;
 inputStr = JOptionPane.showInputDialog(null, "Enter the First Guess");
  firstGuess = Integer.parseInt(inputStr);
inputStr = JOptionPane.showInputDialog(null, "Enter the Second Guess");
 secondGuess = Integer.parseInt(inputStr);
inputStr = JOptionPane.showInputDialog(null, "Enter the Third Guess");
  thirdGuess = Integer.parseInt(inputStr);

 fermi.Game();


	}

	}

class Fermi{

	private final double max = 9;

    private final double min = 0;

    private int firstGuess;

    private int secondGuess;

    private int thirdGuess;





    public Fermi(){



    	 fermi1 = (int) (Math.floor(Math.random()  *  (max - min + 1))
                                                         + min);


  	 while(fermii == fermi2){
  	 	fermi2 = (int) (Math.floor(Math.random()  *  (max - min + 1))
  	 		                                                 + min);

  	 }

      while	(fermi3 == fermi2 || fermi3 == fermi1){
      	fermi3 = (int) (Math.floor(Math.random()  *  (max - min + 1))
  	                                                  + min);
      }


    public boolean Game(){


      	while(playgame){


		String inputStr;
   inputStr = JOptionPane.showInputDialog(null, "Enter the First Guess");
   firstGuess = Integer.parseInt(inputStr);
inputStr = JOptionPane.showInputDialog(null, "Enter the Second Guess");
  secondGuess = Integer.parseInt(inputStr);
inputStr = JOptionPane.showInputDialog(null, "Enter the Third Guess");
   thirdGuess = Integer.parseInt(inputStr);


	if (fermi1 == firstGuess){
   System.out.print(" Fermi");
    }
    if(fermi2 ==  thirdGuess  || fermi1 ==  thirdGuess){

   	System.out.print("pico");
    }
 if(fermi1 !=  thirdGuess  || fermi3 !=  thirdGuess || fermi2 != thirdGuess  ){

   System.out.print(" Nano");
 }


      	}

      	}


  }
    }

Edited 5 Years Ago by peter_budo: Keep It Clear - Do use code tags when posting any code

please help me to working under the Jcreator for random number the problmes is public bollean game

Can you explain what your problem is? Do you have some specific questions?

When you post code, please put the code in code tags. Use the CODE icon above the input box. Unformatted code is hard to read.

Edited 3 Years Ago by happygeek: fixed formatting

import java.util.*;
import javax.swing.JOptionPane;
import java.text.*;

class playGames{

public static void main (String [] args){



     int num1 = fermi.fermi1();
     int num2 = fermi.fermi2();
     int num2 = fermi.fermi3();






	boolean playGames = true;


	int firstGuess;
	int secondGuess;
	int thirdGuess;




while(playGames){
String inputStr;
 inputStr = JOptionPane.showInputDialog(null, "Enter the First Guess");
  firstGuess = Integer.parseInt(inputStr);
inputStr = JOptionPane.showInputDialog(null, "Enter the Second Guess");
 secondGuess = Integer.parseInt(inputStr);
inputStr = JOptionPane.showInputDialog(null, "Enter the Third Guess");
  thirdGuess = Integer.parseInt(inputStr);

fermi.game(firstGuess,secondGuess, thirdGuess);



}

	 Fermi fermi;
	 fermi = new Fermi(firstGuess, secondGuess, thirdGuess );

}
}


class Fermi{
private final double max = 9;
private final double min = 0;




private String hin1, hin2, hin3;

private int firstGuess;
private	 int secondGuess;
private	 int thirdGuess;

public Fermi(int a, int b, int c){

	firstGuess = a;
	secondGuess = b;
	thirdGuess = c;

}


public void fermi(){
	 fermi1 = (int) (Math.floor(Math.random()  *  (max - min + 1))
                                                         + min);


  	 while(fermii == fermi2){
  	 	fermi2 = (int) (Math.floor(Math.random()  *  (max - min + 1))
  	 		                                                 + min);

  	 }

      while	(fermi3 == fermi2 || fermi3 == fermi1){
      	fermi3 = (int) (Math.floor(Math.random()  *  (max - min + 1))
  	                                                  + min);
      }
}


public void game(int firstGuess, int secondGuess, int thirdGuess){when put illegal expression

while(playgame){



 inputStr = JOptionPane.showInputDialog(null, "Enter the First Guess");
  int firstGuess = Integer.parseInt(inputStr);
inputStr = JOptionPane.showInputDialog(null, "Enter the Second Guess");
 int secondGuess = Integer.parseInt(inputStr);
inputStr = JOptionPane.showInputDialog(null, "Enter the Third Guess");
  int thirdGuess = Integer.parseInt(inputStr);
return game;
}












public String hint1(){ when put illegal expression
	if (fermi1 == firstGuess){
    hin1 = " Fermi";
    }
    if(fermi2 ==  thirdGuess  || fermi1 ==  thirdGuess){

   	hin1 ="pico";
    }
 if(fermi1 !=  thirdGuess  || fermi3 !=  thirdGuess || fermi2 != thirdGuess  ){

   	hin1 =" Nano";
 }

   	return hin1;


 }





public  String hint2(){when put illegal expression


	if (fermi1 == firstGuess){

	hin2 = " Fermi";
	}
	if(fermi2 ==  thirdGuess  || fermi1 ==  thirdGuess){

	hin2= " pico";

	}
 if(fermi1 !=  thirdGuess  || fermi3 !=  thirdGuess || fermi2 != thirdGuess  ){

	hin2 = " Nano";
 }
	return hin2;


 }




public String hint3(){when put illegal expression


	if (fermi1 == firstGuess){

	hin3 = " Fermi";

	}
	if(fermi2 ==  thirdGuess  || fermi1 ==  thirdGuess){

	hin3 = " pico";
	}
 if(fermi1 !=  thirdGuess  || fermi3 !=  thirdGuess || fermi2 != thirdGuess  ){

 hin3 = " Nano";
 }
 return hin3;


  }



}
}

Edited 5 Years Ago by peter_budo: Keep It Clear - Do use code tags when posting any code

Please use code tags when posting your code. Select your code and press the CODE icon above the input box.

If you are getting errors, please copy the full text and post it here.

Get rid of all the extra blank lines. one or two is enough. You code takes TOO many lines.

Edited 3 Years Ago by happygeek: fixed formatting

This article has been dead for over six months. Start a new discussion instead.