import java.util.Scanner;
public class PasswordGen{
public static void main(String[] args){
Scanner input = new Scanner(System.in);
System.out.print("Please insert the size of your password.\n");
int passlength = input.nextInt();
password(passlength);
}
public static void password(int num){
int i;
int[] password = new int[num];
for(i = 0; i < num; i++){
switch((int)(1 + (Math.random() * 3))){
case 1:
int offsetLarge = 'Z'-'A';
int letterLarge = (int)('A' + (Math.random() * offsetLarge));
password[i] = letterLarge;
break;
case 2:
int offsetSmall = 'z'-'a';
int letterSmall = (int)('a' + (Math.random() * offsetSmall));
password[i] = letterSmall;
break;
case 3:
int offsetNumber = '9'-'0';
int number = (int)('0' + (Math.random() * offsetNumber));
password[i] = number;
break;
}
}
System.out.print("Your password: ");
for(i = 0; i < password.length; i++){
System.out.print((char)password[i]);
}
System.out.print("\n");
}
}