/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package lab10_calebfontenot;

import java.util.Scanner;

/**
 *
 * @author caleb
 */
public class PasswordMaker2 {
    public static void main(String[] args) {
       // Create Scanner
       Scanner input = new Scanner(System.in);

        String firstName; int lenFirstName;
        //String middleName; int lenMiddleName;
        String lastName; int lenLastName;
        String birthYear, birthYearTruncated;
        
        // Prompt for input
        System.out.println("Enter first name, last name, and your year of birth and I will generate a password for you:");
        firstName = input.next();
        //middleName = input.next();
        lastName = input.next();
        birthYear = input.next();
        
        // Count number of chars in inputs
        lenFirstName = firstName.length();
        //lenMiddleName = middleName.length();
        lenLastName = lastName.length();
        
        // Extract last two places from age
        birthYearTruncated = birthYear.substring(2,4);
        
            //> extract chars
        String passwordChars = firstName.substring((lenFirstName - 2),lenFirstName) +
                               lastName.substring((lenLastName - 2), lenLastName);
            //> append age after changing the initials to lower case
        String password = passwordChars.toLowerCase() + birthYearTruncated;
        System.out.println("Your Password = " + password);
    //middleName.substring((lenMiddleName - 2), lenMiddleName) + 
    
    }
}
