Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Here is the code for the first program:
- package com.Suarez;
- /*
- Xander Fermier
- 1/15/19
- the user inputs two passwords and if they match then it will confirm their passwrod, if not it will deny it
- */
- import java.util.*;
- public class PasswordCheck {
- public static void main(String[] args)
- {
- System.out.println("Enter your password.");
- Scanner scan = new Scanner(System.in);
- String pass1 = scan.next();
- System.out.println("Confirm your passwords");
- String pass2 = scan.next();
- if (pass1.equals(pass2))
- {
- System.out.println("You are now registered as a new user.");
- }
- else
- {
- System.out.println("Sorry, there is a typo in your password");
- }
- }
- }
- Here is the code for the second program:
- package com.Suarez;
- /*
- Xander Fermier
- 1/15/19
- the user inputs an ID and then the computer determines whether or not it is valid based on its length
- */
- import java.util.*;
- public class UserIDTest {
- public static void main(String [] args)
- {
- System.out.println("Enter a username.");
- Scanner scan = new Scanner(System.in);
- String username = scan.next();
- int userlength = username.length();
- if (userlength >= 6 && userlength <= 10)
- {
- System.out.print("Welcome, " + username);
- }
- else
- {
- System.out.print("Sorry, user ID invalid");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement