You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

LogIn.java 967 B

2 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package homework.pkg5;
  2. import java.util.Scanner;
  3. public class LogIn{
  4. public static void main(String[] args) {
  5. //declare variables
  6. String username, password;
  7. int n = 0;
  8. Scanner scanner = new Scanner (System.in);
  9. while (n<3) {
  10. //prompt user for their username
  11. System.out.print("Enter your username: ");
  12. username = scanner.nextLine();
  13. //prompt user for their password
  14. System.out.print("Enter your password: ");
  15. password = scanner.nextLine();
  16. if ("Justinfromcharleston@gmail.com".equals(username) && "secret17".equals(password))
  17. { System.out.println("Welcome " + username + "!!!");
  18. break;
  19. }
  20. else if(!"secret17".equals(password) || !"Justinfromcharleston@gmail.com".equals(username)) {
  21. System.out.println("Incorrect login. Please try again.");
  22. }
  23. }
  24. }
  25. }

No Description

Contributors (1)