Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1.  
  2. import java.util.Scanner;
  3.  
  4. public class Usernames {
  5.  
  6. public static void main(String[] args) {
  7. Scanner reader = new Scanner(System.in);
  8.  
  9. System.out.print("Type your username: ");
  10. String username = reader.nextLine();
  11.  
  12. System.out.print("Type your password: ");
  13. String password = reader.nextLine();
  14.  
  15.  
  16.  
  17. if ((!(username.equals("alex"))) || (!(username.equals("emily")))) {
  18. System.out.println("Your username or password was invalid!");
  19.  
  20.  
  21. } if (!(username.equals("alex"))) {
  22.  
  23. } else if (!(password.equals("mightyducks"))) {
  24. System.out.println("Your username or password was invalid!");
  25. } else {
  26. System.out.println("You are now logged into the system!");
  27.  
  28.  
  29. } if (!(username.equals("emily"))) {
  30.  
  31. } else if (!(password.equals("cat"))) {
  32. System.out.println("Your username or password was invalid!");
  33. } else {
  34. System.out.println("You are now logged into the system!");
  35. }
  36.  
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement