I atempted to do what was asked and incountered a few errors can anyone tell me how to fix this so it works?
/*
* im trying to do this to allow mulitiple choices it wont tske it a i dont know how to fic it
if (passSize == 1)
{
letterSelecter = myRandom.nextInt (25) + 1;
passLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
}
if (passSize == 2)
{
letterSelecter = myRandom.nextInt (25) + 1;
passLetters = "abcdefghijklmnopqrstuvwxyz";
}
if (passSize == 3)
{
letterSelecter = myRandom.nextInt (51) + 1;
passLetters = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz";
}
*/
// The "PasswordGenerator" class.
import hsa.Stdin;
import java.util.Random;
public class PasswordGenerator
{
public static void main (String[] args)
{
//declaring variables
boolean end = false;
String passLetters;
int numOfPassLetters, numOfPassNumbers, numOfPasswordsGenerated,letterSelecter;
Random myRandom = new Random ();
System.out.println ("RANDOM PASSWORD GENERATOR\n");
do
{
System.out.print ("\nEnter 1 for all caps, 2 for all lower cased and 3 for both");
int passSize = Stdin.readInt ();
System.out.print ("\nEnter the number of letters you want in your pasword: ");
numOfPassLetters = Stdin.readInt ();
System.out.print ("\nEnter the number of numbers you want in your password: ");
numOfPassNumbers = Stdin.readInt ();
System.out.print ("\nEnter How many Passwords that you want to display to choose from: ");
numOfPasswordsGenerated = Stdin.readInt ();
// number of passwords Generated
for (int numOfPasswords = 0 ; numOfPasswords < numOfPasswordsGenerated ; numOfPasswords++)
{ //number of letter in each password
for (int numOfLetters = 0 ; numOfLetters < numOfPassLetters ; numOfLetters++)
{
System.out.print (passLetters.substring (letterSelecter, letterSelecter + 1));
} //numbr of numbers placed in each password
for (int numOfNumbers = 0 ; numOfNumbers < numOfPassNumbers ; numOfNumbers++)
{
int numberSelector = myRandom.nextInt (9);
System.out.print (numberSelector);
}
System.out.print ("\n\n");
}
System.out.print ("Would you like to generate more passwords? type 1 to generate more\nEnter 2 to stop: ");
int determineEnd = Stdin.readInt ();
if (determineEnd == 2)
{
System.out.println ("\nProgram will now Terminate");
end = true;
}
}
while (end == false);
} // main method
} // PasswordGenerator class
there is what im at this point im thinking of allowing the option of mixing letters and numbers but havent got there yet i need to get past this stage before i make any more changes