/home/caleb/ASDV-Java/Assignments/Lab10_CalebFontenot/src/lab10_calebfontenot/PasswordMaker2.java |
nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt
nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java
package lab10_calebfontenot;
import java.util.Scanner;
public class PasswordMaker2 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String firstName; int lenFirstName;
String lastName; int lenLastName;
String birthYear, birthYearTruncated;
System.out.println("Enter first name, last name, and your year of birth and I will generate a password for you:");
firstName = input.next();
lastName = input.next();
birthYear = input.next();
lenFirstName = firstName.length();
lenLastName = lastName.length();
birthYearTruncated = birthYear.substring(2,4);
String passwordChars = firstName.substring((lenFirstName - 2),lenFirstName) +
lastName.substring((lenLastName - 2), lenLastName);
String password = passwordChars.toLowerCase() + birthYearTruncated;
System.out.println("Your Password = " + password);
}
}