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");
}
}
}
}
}
umsungun
-4
Newbie Poster
Recommended Answers
Jump to PostCan 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.
All 4 Replies
umsungun
-4
Newbie Poster
NormR1
563
Posting Sage
Team Colleague
umsungun
-4
Newbie Poster
NormR1
563
Posting Sage
Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.