import java.util.Random;
import java.util.Scanner;
public class AssignmentMenu {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int loop = 0;
String randomLetters[] = { "a", "b" , "c", "e" , "d" ,"f" , "g" , "h ", "i", "j" , "k" , "l" , "m" , "n" , "o", "p" , "q" , "r" , "s" , "t", "u", "v" , "w" , "x" , "y" , "z"};
String randomVowels[] = { "a" , "e" , "i" , "o" , "u" };
String P1[] = new String[10];
int numberOfVowels = 0;
Random generator = new Random();
// AllMemberDetails[] = StudentID[0] + Name[0] + MobilePhoneNumber[0];
Scanner strInput = new Scanner(System.in); // str
while (loop < 3) {
try {
{
String P1word1 = "null";
String P1word2 = "null";
String P1word3 = "null";
String P2word1 = "null";
String P2word2 = "null";
String P2word3 = "null";
if ( P1word1.equals("@") || P2word1.equals("@") || P1word2.equals("@") || P2word2.equals("@") || P1word3.equals("@") || P2word3.equals("@") ) {
System.out.println("You have chosen @, to skip a turn.");
String skip1Line = scan.nextLine();
} else if ( P1word1.equals("!") || P2word1.equals("!") || P1word2.equals("!") || P2word2.equals("!") || P1word3.equals("!") || P2word3.equals("!") ) {
System.exit(0);
} else
System.out.println(" "); {
}
}
System.out.println("FindYourWords Game(:");
System.out.println("----------------------------------------------------------------------");
System.out.print("Player[1] HERE ARE YOUR LETTERS:" + "\t");
int vowelCount = 0;
Boolean lessThan2Vowel= true;
while (lessThan2Vowel)
{
for (int i = 0; i < randomLetters.length; i++)
{
randomVowels[i] = randomLetters[generator.nextInt(26)];
}
// Checking the number of vowels in the random letters array
for (int j = 0; j < randomLetters.length; j++)
{
for (int h = 0; h < randomVowels.length; h++)
{
if (randomLetters[j] == randomVowels[h])
{
vowelCount = vowelCount + 1;
}
}
}
if (vowelCount >= 2)
{
lessThan2Vowel = false;
}
else
{
vowelCount = 0;
}
for (int i =0; i < 10; i++) {
int j = generator.nextInt(26);
System.out.print( randomLetters[j] + " ");
for (int v = 0; v < randomVowels.length; v++){
if ( P1[i] == (randomVowels[v]) ){
numberOfVowels ++;
}
}
}
}
} catch (Exception e) {
// catch \n of the scan error exception
String junk = strInput.nextLine();
System.out.println(" ** Error! Unknown option. ** ");
System.out.println(" ** Please try again ** ");
} finally {
} // end Finally
} // end While
} // end While
} // end Class
thepussy 0 Newbie Poster
thepussy 0 Newbie Poster
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.