1c7

nick is ugly

1c7
Nov 3rd, 2019
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. // emailapp.java
  2.  
  3. public class EmailApp {
  4. public static void main(String[] args){
  5. Email user = new Email();
  6. user.createEmail();
  7. }
  8. }
  9.  
  10.  
  11. // email.java - new file
  12.  
  13. import java.util.Random;
  14. import java.util.Scanner;
  15.  
  16. public class Email {
  17. private String firstName;
  18. private String lastName;
  19. private String company;
  20. private String password;
  21. private String[] usersFirstName = {"Alex", "Fay", "Elliemae", "Lawrence"};
  22. private String[] usersLastName = {"OConnor", "Powell", "Hull", "Watson"};
  23. private int numbers;
  24. Random rand = new Random();
  25. Scanner input = new Scanner(System.in);
  26.  
  27. public void createEmail(){
  28. this.firstName = setFirstName().toLowerCase();
  29. this.lastName = setLastName().toLowerCase();
  30. this.company = setCompany().toLowerCase();
  31. this.numbers = setNumbers();
  32. this.password = setPassword();
  33. System.out.println("Email Created: " + this.firstName + this.lastName + this.numbers + "@" + this.company + ".com");
  34. System.out.println("Password: " + this.password);
  35.  
  36. }
  37. private String setPassword(){
  38. this.password = this.firstName.charAt(0) + this.lastName + this.numbers;
  39. return this.password;
  40. }
  41. private String setFirstName(){
  42. System.out.println("Enter your first name:");
  43. this.firstName = input.nextLine();
  44. return this.firstName;
  45. }
  46. private String setLastName(){
  47. System.out.println("Enter your last name:");
  48. this.lastName = input.nextLine();
  49. return this.lastName;
  50. }
  51. private int randNum(int min, int max){
  52. int randNum = rand.nextInt((max - min) + 1) + min;
  53. return randNum;
  54. }
  55. private int setNumbers(){
  56. this.numbers = randNum(111, 999);
  57. return this.numbers;
  58. }
  59. private String setCompany(){
  60. System.out.println("Enter the company name:");
  61. this.company = input.nextLine();
  62. return this.company;
  63. }
  64.  
  65. }
Advertisement
Add Comment
Please, Sign In to add comment