Advertisement
sudoaptinstallname

Untitled

Jan 17th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class SeasonFinder {
  6.  
  7. public static void main(String[] args){
  8. Scanner input = new Scanner(System.in);
  9.  
  10. int x = 0;
  11.  
  12. System.out.print("Input your Username:");
  13. String usr = input.nextLine();
  14. System.out.print("Input your Password:");
  15. String pwd = input.nextLine();
  16.  
  17.  
  18. //case statements can't perform logic.
  19.  
  20. if(usr.equals("admin"))
  21. {
  22. x = x+10;
  23. }
  24. if(pwd.equals("open"))
  25. {
  26. x = x+1;
  27. }
  28.  
  29. switch(x)
  30. {
  31. case(11):
  32. System.out.print("Welcome.");
  33. break;
  34. case(10):
  35. System.out.print("Wrong Password");
  36. break;
  37. case(1):
  38. System.out.print("Wrong User ID");
  39. default:
  40. System.out.print("Sorry, wrong User ID and Password");
  41.  
  42. }
  43.  
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement