diff --git a/Assignments/Lab10_CalebFontenot/CharacterClassStringClass.html b/Assignments/Lab10_CalebFontenot/CharacterClassStringClass.html new file mode 100644 index 0000000..f12c29d --- /dev/null +++ b/Assignments/Lab10_CalebFontenot/CharacterClassStringClass.html @@ -0,0 +1,87 @@ + + + +CharacterClassStringClass.java + + + + +
/home/caleb/ASDV-Java/Assignments/Lab10_CalebFontenot/src/lab10_calebfontenot/CharacterClassStringClass.java
+
+/*
+ * 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 CharacterClassStringClass {
+
+    public static void main(String[] args) {
+        // Create Scanner
+        Scanner input = new Scanner(System.in);
+
+        // Declare variables
+        String userResponse;
+        boolean loopToggle = true;
+        int parseCheck;
+
+        // While loop
+        while (loopToggle) {
+            System.out.println("Continue looping?");
+            System.out.println("Please enter y/n or yes/no: ");
+            userResponse = input.next();
+
+            if (userResponse.toLowerCase().charAt(0) == 'y') {
+                // User has responded with 'y'
+                System.out.println("You typed '" + userResponse + '\'');
+                System.out.println("ok!");
+            } else if (userResponse.toLowerCase().charAt(0) == 'n') {
+                // User has responded with 'n'
+                System.out.println("You typed " + userResponse.charAt(0));
+                // Kill the loop.
+                loopToggle = false;
+            } // Invalid input handling
+            else {
+                // Attempt to parse string as an integer.
+                try {
+                    parseCheck = Integer.parseInt(userResponse);
+                    // If it got past this, the user entered a number.
+                    System.out.println("Invalid input! You entered " + parseCheck + ", which is an integer!");
+                } catch (NumberFormatException ex) {
+                    if (!(userResponse.length() > 1)) { // Condition is true if response is a char.
+                        System.out.println("'" + userResponse + "' is an incorrect character!");
+                    } else { // Response is a string.
+                        System.out.println("'" + userResponse + "' is too long!");
+                    }
+                }
+
+            }
+
+        }
+
+    }
+}
+
+
+ diff --git a/Assignments/Lab10_CalebFontenot/EscapeSequencesAndUnicode.html b/Assignments/Lab10_CalebFontenot/EscapeSequencesAndUnicode.html new file mode 100644 index 0000000..739324f --- /dev/null +++ b/Assignments/Lab10_CalebFontenot/EscapeSequencesAndUnicode.html @@ -0,0 +1,55 @@ + + + +EscapeSequencesAndUnicode.java + + + + +
/home/caleb/ASDV-Java/Assignments/Lab10_CalebFontenot/src/lab10_calebfontenot/EscapeSequencesAndUnicode.java
+
+/*
+ * 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;
+
+/**
+ *
+ * @author caleb
+ */
+public class EscapeSequencesAndUnicode {
+    public static void main(String[] args) {
+        
+        System.out.println("I delete the last 3 characterssss\b\b\b");
+        System.out.println("\t\tI used 2 tabs here");
+        System.out.println("I printed a \" inside quotes");
+        
+        char b = 'b';
+        char bCapital = 66;
+        char a = '\u0061'; //16 * 6 + 1 = 96 in decimal
+        char aCapital = 0x41;
+        char greekAlpha = '\u03b1'; // 3 x 256 + 11 x 16 + 1 = ? in decimal
+                
+        System.out.println("I print in latin and in greek ---> "+ 
+                + b + " "
+                + bCapital + " "
+                + aCapital + " "
+                + a + " "
+                + greekAlpha );
+    }
+}
+
+
+ diff --git a/Assignments/Lab10_CalebFontenot/IndependanceUSA.html b/Assignments/Lab10_CalebFontenot/IndependanceUSA.html new file mode 100644 index 0000000..a681b1b --- /dev/null +++ b/Assignments/Lab10_CalebFontenot/IndependanceUSA.html @@ -0,0 +1,66 @@ + + + +IndependanceUSA.java + + + + +
/home/caleb/ASDV-Java/Assignments/Lab10_CalebFontenot/src/lab10_calebfontenot/IndependanceUSA.java
+
+/*
+ * 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 IndependanceUSA {
+
+    public static void main(String[] args) {
+        // Setup vars
+        String month, day, year;
+
+        // Create scanner
+        Scanner input = new Scanner(System.in);
+        boolean conditionStillTrue = true;
+        // Prompt for input
+        System.out.println("Please enter the date of Independence. (Month, day, year): ");
+        month = input.next();
+        day = input.next();
+        year = input.next();
+
+        if (month.compareToIgnoreCase("july") == 0) {
+            if (day.compareToIgnoreCase("4th") == 0 || (day == "4")) {
+                if (year.compareToIgnoreCase("1776") == 0) {
+                    System.out.println("Hurrah!");
+                } else {
+                    System.out.println("No, no, no! Incorrect!");
+                }
+            } else {
+                System.out.println("No, no, no! Incorrect!");
+            }
+        } else {
+            System.out.println("No, no, no! Incorrect!");
+        }
+    }
+}
+
+
+ diff --git a/Assignments/Lab10_CalebFontenot/PasswordMaker1.html b/Assignments/Lab10_CalebFontenot/PasswordMaker1.html new file mode 100644 index 0000000..a45c78b --- /dev/null +++ b/Assignments/Lab10_CalebFontenot/PasswordMaker1.html @@ -0,0 +1,52 @@ + + + +PasswordMaker1.java + + + + +
/home/caleb/ASDV-Java/Assignments/Lab10_CalebFontenot/src/lab10_calebfontenot/PasswordMaker1.java
+
+/*
+ * 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;
+
+/**
+ *
+ * @author caleb
+ */
+public class PasswordMaker1 {
+    public static void main(String[] args) {
+        String firstName = "Caleb";
+        String middleName = "Christopher";
+        String lastName = "Fontenot";
+        int age = 20;
+            //> extract initials
+        String initials = firstName.substring(0,1) + 
+                          middleName.substring(0,1) + 
+                          lastName.substring(0,1);
+            //> append age after changing the initials to lower case
+        String password = initials.toLowerCase() + age;
+        System.out.println("Your Password = " + password);
+    }
+}
+
+
+ diff --git a/Assignments/Lab10_CalebFontenot/PasswordMaker2.html b/Assignments/Lab10_CalebFontenot/PasswordMaker2.html new file mode 100644 index 0000000..6dbe3f2 --- /dev/null +++ b/Assignments/Lab10_CalebFontenot/PasswordMaker2.html @@ -0,0 +1,74 @@ + + + +PasswordMaker2.java + + + + +
/home/caleb/ASDV-Java/Assignments/Lab10_CalebFontenot/src/lab10_calebfontenot/PasswordMaker2.java
+
+/*
+ * 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) + 
+    
+    }
+}
+
+
+ diff --git a/Assignments/Lab10_CalebFontenot/ReadWriteCapsOrSmallLetters.html b/Assignments/Lab10_CalebFontenot/ReadWriteCapsOrSmallLetters.html new file mode 100644 index 0000000..20a0df5 --- /dev/null +++ b/Assignments/Lab10_CalebFontenot/ReadWriteCapsOrSmallLetters.html @@ -0,0 +1,56 @@ + + + +ReadWriteCapsOrSmallLetters.java + + + + +
/home/caleb/ASDV-Java/Assignments/Lab10_CalebFontenot/src/lab10_calebfontenot/ReadWriteCapsOrSmallLetters.java
+
+/*
+ * 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 ReadWriteCapsOrSmallLetters {
+    public static void main(String[] args)
+    {
+        // Declare variables
+        String line;
+        
+        // Setup scanner
+        Scanner input = new Scanner(System.in);
+        
+        // Prompt for input
+        System.out.println("Please enter 5 words on one line seperated by whitespace: ");
+        line = input.nextLine();
+        
+        System.out.println("The line you entered: "+ line);
+        
+        System.out.println("The line you entered in all caps: " + line.toUpperCase());
+        
+        
+        
+    }
+}
+
+
+ diff --git a/Assignments/Lab10_CalebFontenot/ReadWriteName1.html b/Assignments/Lab10_CalebFontenot/ReadWriteName1.html new file mode 100644 index 0000000..2f14978 --- /dev/null +++ b/Assignments/Lab10_CalebFontenot/ReadWriteName1.html @@ -0,0 +1,47 @@ + + + +ReadWriteName1.java + + + + +
/home/caleb/ASDV-Java/Assignments/Lab10_CalebFontenot/src/lab10_calebfontenot/ReadWriteName1.java
+
+/*
+ * 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 ReadWriteName1 {
+    public static void main(String[] args)
+    {
+        Scanner scan = new Scanner(System.in);
+        System.out.print("Please enter your first name followed by your last name \nbeing seperated" +
+                " from each other by whitespace or carriage return: ");
+        String firstName = scan.next();
+        String lastName = scan.next();
+        
+        System.out.println("\nHello " + firstName + " " + lastName + "!");
+    }
+}
+
+
+ diff --git a/Assignments/Lab10_CalebFontenot/ReadWriteName2.html b/Assignments/Lab10_CalebFontenot/ReadWriteName2.html new file mode 100644 index 0000000..b3c1ef8 --- /dev/null +++ b/Assignments/Lab10_CalebFontenot/ReadWriteName2.html @@ -0,0 +1,53 @@ + + + +ReadWriteName2.java + + + + +
/home/caleb/ASDV-Java/Assignments/Lab10_CalebFontenot/src/lab10_calebfontenot/ReadWriteName2.java
+
+/*
+ * 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 ReadWriteName2 {
+    public static void main(String[] args)
+    {
+        // Create scanner
+        Scanner input = new Scanner(System.in);
+        
+        // Setup variables
+        String firstName, lastName;
+        
+        // Prompt for input
+        System.out.println("Please enter your first name, followed by your last name: ");
+        firstName = input.next();
+        lastName = input.next();
+        
+        //Print output
+        System.out.println("Hello, " + firstName + ", " + lastName + ".");
+    }
+}
+
+
+ diff --git a/Assignments/Lab10_CalebFontenot/ReadWriteName3.html b/Assignments/Lab10_CalebFontenot/ReadWriteName3.html new file mode 100644 index 0000000..12309e7 --- /dev/null +++ b/Assignments/Lab10_CalebFontenot/ReadWriteName3.html @@ -0,0 +1,47 @@ + + + +ReadWriteName3.java + + + + +
/home/caleb/ASDV-Java/Assignments/Lab10_CalebFontenot/src/lab10_calebfontenot/ReadWriteName3.java
+
+/*
+ * 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 ReadWriteName3 {
+    public static void main(String[] args)
+    {
+        Scanner scan = new Scanner(System.in);
+        System.out.print("Please enter your first name followed by your last name \nbeing seperated " 
+                + "from each other by whitespace: ");
+        String wholeLine = scan.nextLine();
+        
+        System.out.println("\nHello " + wholeLine + "!");
+        
+    }
+}
+
+
+ diff --git a/Assignments/Lab10_CalebFontenot/Rounding1.html b/Assignments/Lab10_CalebFontenot/Rounding1.html new file mode 100644 index 0000000..5b05664 --- /dev/null +++ b/Assignments/Lab10_CalebFontenot/Rounding1.html @@ -0,0 +1,56 @@ + + + +Rounding1.java + + + + +
/home/caleb/ASDV-Java/Assignments/Lab10_CalebFontenot/src/lab10_calebfontenot/Rounding1.java
+
+/*
+ * 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;
+
+/**
+ *
+ * @author caleb
+ */
+public class Rounding1 {
+    public static void main(String[] args) {
+        System.out.println("Math.ceil(2.1) returns " + Math.ceil(2.1));
+        System.out.println("Math.ceil(2.0) returns " + Math.ceil(2.0));
+        System.out.println("Math.ceil(-2.0) returns " + Math.ceil(-2.0));
+        System.out.println("Math.ceil(-2.1) returns " + Math.ceil(-2.1));
+        System.out.println("Math.floor(2.1) returns " + Math.floor(2.1));
+        System.out.println("Math.floor(2.0) returns " + Math.floor(2.0));
+        System.out.println("Math.floor(-2.0) returns " + Math.floor(-2.0));
+        System.out.println("Math.floor(-3.0) returns " + Math.floor(-3.0));
+        System.out.println("Math.rint(2.1) returns " + Math.rint(2.1));
+        System.out.println("Math.rint(2.0) returns " + Math.rint(2.0));
+        System.out.println("Math.rint(-2.0) returns " + Math.rint(-2.0));
+        System.out.println("Math.rint(-2.1) returns " + Math.rint(-2.1));
+        System.out.println("Math.rint(2.5) returns " + Math.rint(2.5));
+        System.out.println("Math.rint(-2.5) returns " + Math.rint(-2.5));
+        System.out.println("Math.round(-2.6f) returns " + Math.round(-2.6f));
+        System.out.println("Math.round(2.0) returns " + Math.round(2.0));
+        System.out.println("Math.round(-2.0) returns " + Math.round(-2.0));
+        System.out.println("Math.round(-2.6) returns " + Math.round(-2.6));
+    }
+}
+
+
+ diff --git a/Assignments/Lab10_CalebFontenot/src/lab10_calebfontenot/CharacterClassStringClass.java b/Assignments/Lab10_CalebFontenot/src/lab10_calebfontenot/CharacterClassStringClass.java new file mode 100644 index 0000000..20e0901 --- /dev/null +++ b/Assignments/Lab10_CalebFontenot/src/lab10_calebfontenot/CharacterClassStringClass.java @@ -0,0 +1,59 @@ +/* + * 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 CharacterClassStringClass { + + public static void main(String[] args) { + // Create Scanner + Scanner input = new Scanner(System.in); + + // Declare variables + String userResponse; + boolean loopToggle = true; + int parseCheck; + + // While loop + while (loopToggle) { + System.out.println("Continue looping?"); + System.out.println("Please enter y/n or yes/no: "); + userResponse = input.next(); + + if (userResponse.toLowerCase().charAt(0) == 'y') { + // User has responded with 'y' + System.out.println("You typed '" + userResponse + '\''); + System.out.println("ok!"); + } else if (userResponse.toLowerCase().charAt(0) == 'n') { + // User has responded with 'n' + System.out.println("You typed " + userResponse.charAt(0)); + // Kill the loop. + loopToggle = false; + } // Invalid input handling + else { + // Attempt to parse string as an integer. + try { + parseCheck = Integer.parseInt(userResponse); + // If it got past this, the user entered a number. + System.out.println("Invalid input! You entered " + parseCheck + ", which is an integer!"); + } catch (NumberFormatException ex) { + if (!(userResponse.length() > 1)) { // Condition is true if response is a char. + System.out.println("'" + userResponse + "' is an incorrect character!"); + } else { // Response is a string. + System.out.println("'" + userResponse + "' is too long!"); + } + } + + } + + } + + } +} diff --git a/Assignments/Lab10_CalebFontenot/src/lab10_calebfontenot/EscapeSequencesAndUnicode.java b/Assignments/Lab10_CalebFontenot/src/lab10_calebfontenot/EscapeSequencesAndUnicode.java new file mode 100644 index 0000000..f52c6ab --- /dev/null +++ b/Assignments/Lab10_CalebFontenot/src/lab10_calebfontenot/EscapeSequencesAndUnicode.java @@ -0,0 +1,31 @@ +/* + * 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; + +/** + * + * @author caleb + */ +public class EscapeSequencesAndUnicode { + public static void main(String[] args) { + + System.out.println("I delete the last 3 characterssss\b\b\b"); + System.out.println("\t\tI used 2 tabs here"); + System.out.println("I printed a \" inside quotes"); + + char b = 'b'; + char bCapital = 66; + char a = '\u0061'; //16 * 6 + 1 = 96 in decimal + char aCapital = 0x41; + char greekAlpha = '\u03b1'; // 3 x 256 + 11 x 16 + 1 = ? in decimal + + System.out.println("I print in latin and in greek ---> "+ + + b + " " + + bCapital + " " + + aCapital + " " + + a + " " + + greekAlpha ); + } +} diff --git a/Assignments/Lab10_CalebFontenot/src/lab10_calebfontenot/IndependanceUSA.java b/Assignments/Lab10_CalebFontenot/src/lab10_calebfontenot/IndependanceUSA.java index 05990d4..842581c 100644 --- a/Assignments/Lab10_CalebFontenot/src/lab10_calebfontenot/IndependanceUSA.java +++ b/Assignments/Lab10_CalebFontenot/src/lab10_calebfontenot/IndependanceUSA.java @@ -12,29 +12,31 @@ import java.util.Scanner; */ public class IndependanceUSA { - public static void main(String[] args) - { + public static void main(String[] args) { // Setup vars String month, day, year; // Create scanner Scanner input = new Scanner(System.in); boolean conditionStillTrue = true; - // Prompt fo rinput + // Prompt for input System.out.println("Please enter the date of Independence. (Month, day, year): "); month = input.next(); day = input.next(); year = input.next(); - if (month.compareToIgnoreCase("july") == 1) { - - } - if (day.compareToIgnoreCase("4th" ) == 1) { - if (year == 1776) { + if (month.compareToIgnoreCase("july") == 0) { + if (day.compareToIgnoreCase("4th") == 0 || (day == "4")) { + if (year.compareToIgnoreCase("1776") == 0) { System.out.println("Hurrah!"); - else { - System.out.println("No no no! Incorrect!"); + } else { + System.out.println("No, no, no! Incorrect!"); + } + } else { + System.out.println("No, no, no! Incorrect!"); + } + } else { + System.out.println("No, no, no! Incorrect!"); + } } - -} } diff --git a/Assignments/Lab10_CalebFontenot/src/lab10_calebfontenot/PasswordMaker1.java b/Assignments/Lab10_CalebFontenot/src/lab10_calebfontenot/PasswordMaker1.java new file mode 100644 index 0000000..12e8fb9 --- /dev/null +++ b/Assignments/Lab10_CalebFontenot/src/lab10_calebfontenot/PasswordMaker1.java @@ -0,0 +1,25 @@ +/* + * 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; + +/** + * + * @author caleb + */ +public class PasswordMaker1 { + public static void main(String[] args) { + String firstName = "Caleb"; + String middleName = "Christopher"; + String lastName = "Fontenot"; + int age = 20; + //> extract initials + String initials = firstName.substring(0,1) + + middleName.substring(0,1) + + lastName.substring(0,1); + //> append age after changing the initials to lower case + String password = initials.toLowerCase() + age; + System.out.println("Your Password = " + password); + } +} diff --git a/Assignments/Lab10_CalebFontenot/src/lab10_calebfontenot/PasswordMaker2.java b/Assignments/Lab10_CalebFontenot/src/lab10_calebfontenot/PasswordMaker2.java new file mode 100644 index 0000000..c8d00ea --- /dev/null +++ b/Assignments/Lab10_CalebFontenot/src/lab10_calebfontenot/PasswordMaker2.java @@ -0,0 +1,47 @@ +/* + * 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) + + + } +} diff --git a/Assignments/Lab10_CalebFontenot/src/lab10_calebfontenot/Rounding1.java b/Assignments/Lab10_CalebFontenot/src/lab10_calebfontenot/Rounding1.java new file mode 100644 index 0000000..9c0d4cd --- /dev/null +++ b/Assignments/Lab10_CalebFontenot/src/lab10_calebfontenot/Rounding1.java @@ -0,0 +1,32 @@ +/* + * 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; + +/** + * + * @author caleb + */ +public class Rounding1 { + public static void main(String[] args) { + System.out.println("Math.ceil(2.1) returns " + Math.ceil(2.1)); + System.out.println("Math.ceil(2.0) returns " + Math.ceil(2.0)); + System.out.println("Math.ceil(-2.0) returns " + Math.ceil(-2.0)); + System.out.println("Math.ceil(-2.1) returns " + Math.ceil(-2.1)); + System.out.println("Math.floor(2.1) returns " + Math.floor(2.1)); + System.out.println("Math.floor(2.0) returns " + Math.floor(2.0)); + System.out.println("Math.floor(-2.0) returns " + Math.floor(-2.0)); + System.out.println("Math.floor(-3.0) returns " + Math.floor(-3.0)); + System.out.println("Math.rint(2.1) returns " + Math.rint(2.1)); + System.out.println("Math.rint(2.0) returns " + Math.rint(2.0)); + System.out.println("Math.rint(-2.0) returns " + Math.rint(-2.0)); + System.out.println("Math.rint(-2.1) returns " + Math.rint(-2.1)); + System.out.println("Math.rint(2.5) returns " + Math.rint(2.5)); + System.out.println("Math.rint(-2.5) returns " + Math.rint(-2.5)); + System.out.println("Math.round(-2.6f) returns " + Math.round(-2.6f)); + System.out.println("Math.round(2.0) returns " + Math.round(2.0)); + System.out.println("Math.round(-2.0) returns " + Math.round(-2.0)); + System.out.println("Math.round(-2.6) returns " + Math.round(-2.6)); + } +} diff --git a/ZIPs/Lab10_CalebFontenot.zip b/ZIPs/Lab10_CalebFontenot.zip new file mode 100644 index 0000000..b390255 Binary files /dev/null and b/ZIPs/Lab10_CalebFontenot.zip differ