· 9 years ago · Nov 19, 2016, 08:34 AM
1import java.util.Scanner;
2public class EmailGenerator {
3 public static void main(String args[]) {
4
5 //Receives inputs of possible names and contains most common emails to generate an email from.
6 Scanner name = new Scanner(System.in);
7 System.out.println("First name");
8 String firstName = name.next();
9 System.out.println("Last name");
10 String lastName = name.next();
11 String[] endings = {"@gmail.com", "@yahoo.com", "@outlook.com"};
12
13 //Possible middle modifies
14 String[] modifiers = {".", "_", ""};
15
16 //For loop to generate and print out the names...
17
18 for(int i = 0; i < endings.length; i++) {
19 for(int j = 0; j < modifiers.length; j++) {
20
21 System.out.println(firstName +modifiers[j] +lastName +endings[i]);
22 System.out.println(lastName +modifiers[j] +firstName +endings[i]);
23
24 }
25
26
27}
28 name.close();
29}
30}