Guest User

Week1 Exercise 20 http://mooc.cs.helsinki.fi/programming-par

a guest
May 24th, 2016
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.66 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Usernames {
  4.  
  5.     public static void main(String[] args) {
  6.         Scanner reader = new Scanner(System.in);
  7.  
  8.         System.out.println("Type your username: ");
  9.         String user = reader.nextLine();
  10.        
  11.         System.out.println("Type your password: ");
  12.         String pass = reader.nextLine();
  13.        
  14.         if ((!(user.equals("alex")) && (pass.equals("mightyducks"))) || (!(user.equals("emily")) && (pass.equals("cat")))) {
  15.             System.out.println("You are now logged into the system!");
  16.         } else {
  17.             System.out.println("Your username or password was invalid!");
  18.         }
  19.     }
  20. }
Add Comment
Please, Sign In to add comment