Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package random.idkyet.part1;
- import java.util.Scanner;
- public class RandomIdkyetPart1 {
- public static void main(String[] args) {
- int a = 0, b = -1;
- Scanner sc = new Scanner(System.in);
- String[] names = new String[3];
- String[] combineNames = new String[6];
- String[] initials = new String[6];
- System.out.println("Input " + names.length + " names");
- for (int x = 0; x < names.length; x++) {
- System.out.print("Name " + (x + 1) + ":");
- names[x] = sc.next();
- }
- for (int x = 0; x < names.length; x++) {
- if (!(a == x)) {
- b++;
- initials[b] = names[a].charAt(0) + " " + names[x].charAt(0);
- combineNames[b] = names[a] + " " + names[x];
- }
- if (x == names.length - 1) {
- x = -1;
- if (!(a == names.length - 1)) {
- a++;
- } else {
- break;
- }
- }
- }
- System.out.println("Possible names are:\n");
- for (int x = 0; x < combineNames.length; x++) {
- System.out.println((x + 1) + "-" + combineNames[x]+"\n");
- }
- System.out.print("Enter 1-6 to select a name: ");
- int select = sc.nextInt() - 1;
- System.out.println("\nThe intial for "+combineNames[select]+" are " + initials[select].toUpperCase().replace(" ", "") + ".\n\nSuggested username: " + combineNames[select].toLowerCase().replace(" ", "_"));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement