diff --git a/.gitignore b/.gitignore index a68ce6f..9aa5929 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /lab4_CalebFontenot/target/ +/lab5_CalebFontenot/target/ diff --git a/MP1_CalebFontenot/target/classes/.netbeans_automatic_build b/MP1_CalebFontenot/target/classes/.netbeans_automatic_build deleted file mode 100644 index e69de29..0000000 diff --git a/MP1_CalebFontenot/target/test-classes/.netbeans_automatic_build b/MP1_CalebFontenot/target/test-classes/.netbeans_automatic_build deleted file mode 100644 index e69de29..0000000 diff --git a/lab4_CalebFontenot/PDFs/lab4-1 edit.pdf b/lab4_CalebFontenot/PDFs/lab4-1 edit.pdf new file mode 100644 index 0000000..912ddf2 Binary files /dev/null and b/lab4_CalebFontenot/PDFs/lab4-1 edit.pdf differ diff --git a/lab4_CalebFontenot/src/main/java/com/calebfontenot/lab4_calebfontenot/ABCD.java b/lab4_CalebFontenot/src/main/java/com/calebfontenot/lab4_calebfontenot/ABCD.java new file mode 100644 index 0000000..753c43e --- /dev/null +++ b/lab4_CalebFontenot/src/main/java/com/calebfontenot/lab4_calebfontenot/ABCD.java @@ -0,0 +1,17 @@ +/* + * 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 com.calebfontenot.lab4_calebfontenot; + +/** + * + * @author caleb + */ +public class ABCD { + public static void main(String[] args) + { + int ABCD = 1234; + System.out.println(ABCD % 100); + } +} diff --git a/lab4_CalebFontenot/src/main/java/com/calebfontenot/lab4_calebfontenot/Lab4_CalebFontenot.java b/lab4_CalebFontenot/src/main/java/com/calebfontenot/lab4_calebfontenot/Lab4_CalebFontenot.java index da0c328..95d65e0 100644 --- a/lab4_CalebFontenot/src/main/java/com/calebfontenot/lab4_calebfontenot/Lab4_CalebFontenot.java +++ b/lab4_CalebFontenot/src/main/java/com/calebfontenot/lab4_calebfontenot/Lab4_CalebFontenot.java @@ -5,6 +5,8 @@ package com.calebfontenot.lab4_calebfontenot; +import java.util.Scanner; + /** * * @author caleb @@ -12,13 +14,21 @@ package com.calebfontenot.lab4_calebfontenot; public class Lab4_CalebFontenot { public static void main(String[] args) { - - int i = 11, - j = 22; - double x = 11.11, - y = 22.22; + // Setup Scanner; + Scanner input = new Scanner(System.in); - System.out.println("\n" + i + " + " + j + " = " + (i + j)); - System.out.println("\n" + x + " + " + y + " = " + (x + y)); + System.out.println("Enter i, j, x, and y: "); + int i = input.nextInt(); + int j = input.nextInt(); + double x = input.nextDouble(); + double y = input.nextDouble(); + //int i = 11, + // j = 22; + //double x = 11.11, + // y = 22.22; + + // Changed addition to division + System.out.println("\n" + i + " / " + j + " = " + (i / j)); + System.out.println("\n" + x + " / " + y + " = " + (x / y)); } } diff --git a/lab5_CalebFontenot/PDFs/lab5-1-1.pdf b/lab5_CalebFontenot/PDFs/lab5-1-1.pdf new file mode 100644 index 0000000..e139266 Binary files /dev/null and b/lab5_CalebFontenot/PDFs/lab5-1-1.pdf differ diff --git a/lab5_CalebFontenot/pom.xml b/lab5_CalebFontenot/pom.xml new file mode 100644 index 0000000..3ef979d --- /dev/null +++ b/lab5_CalebFontenot/pom.xml @@ -0,0 +1,14 @@ + + + 4.0.0 + com.calebfontenot.lab5_calebfontenot + lab5_CalebFontenot + 1.0-SNAPSHOT + jar + + UTF-8 + 18 + 18 + com.calebfontenot.lab5_calebfontenot.Lab5_CalebFontenot + + \ No newline at end of file diff --git a/lab5_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/Lab5_CalebFontenot.java b/lab5_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/Lab5_CalebFontenot.java new file mode 100644 index 0000000..b70c094 --- /dev/null +++ b/lab5_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/Lab5_CalebFontenot.java @@ -0,0 +1,17 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Project/Maven2/JavaApp/src/main/java/${packagePath}/${mainClassName}.java to edit this template + */ + +package com.calebfontenot.lab5_calebfontenot; + +/** + * + * @author caleb + */ +public class Lab5_CalebFontenot { + + public static void main(String[] args) { + System.out.println("Hello World!"); + } +} diff --git a/lab5_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/Operators.java b/lab5_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/Operators.java new file mode 100644 index 0000000..c0fdf31 --- /dev/null +++ b/lab5_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/Operators.java @@ -0,0 +1,48 @@ +/* + * 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 com.calebfontenot.lab5_calebfontenot; + +/** + * + * @author caleb + */ +public class Operators { + public static void main(String[] args) + { + int x = 8; int y = 15; double d = 2; + + //1. Increment x by 2; + //add code here + x += 2; + + //2. Increment y by 5 using the += operator + //add code here + y += 5; + + //3. Increment d by 1 using the ++ operator + //add code here + d++; + + //4. Modify the expression below to print z1 = 1.5 and not 0.0 + double z1 = ((double) x /(double) y ) * d++; + System.out.println("z1: " + z1 ); + + //5. Modify the expresion below the print z2 = 2.5 and not 0.0 + double z2 = ((double) x /(double) y ) * ++d; + System.out.println("z2: " + z2 ); + + /* 6. Declare a variable z3 of type double and modify the + right hand side of the expression you built in step 5 for the + expression to evaluate 2.0. + Assign the evaluation to varible z3 + */ + double z3 = ((double) x /(double) y * --d); + //add code here + System.out.println("z3: "+ z3 ); + + System.out.println("x=" + x + " y=" + y + " d=" + d + + " z1="+ z1 + " z2=" +z2 + " z3=" +z3); + } +} diff --git a/lab5_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/Swap.java b/lab5_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/Swap.java new file mode 100644 index 0000000..acb28dd --- /dev/null +++ b/lab5_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/Swap.java @@ -0,0 +1,36 @@ +/* + * 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 com.calebfontenot.lab5_calebfontenot; + +import java.util.Scanner; + +/** + * + * @author caleb + */ +public class Swap { + public static void main(String[] args) + { + // Create scanner + Scanner input = new Scanner(System.in); + + // Define vars + double base, + power, + output; + + // Prompt for input + System.out.println("Enter the base to calculate: "); + base = input.nextDouble(); + System.out.println("Enter the power to calculate: "); + power = input.nextDouble(); + + // Calculate + output = Math.pow(base, power); + + // Print result + System.out.println(base+"^"+power+" = "+ output); + } +} diff --git a/lab5_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/WhatsYourName.java b/lab5_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/WhatsYourName.java new file mode 100644 index 0000000..c2c1a7f --- /dev/null +++ b/lab5_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/WhatsYourName.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 com.calebfontenot.lab5_calebfontenot; + +import java.util.Scanner; + +/** + * + * @author caleb + */ +public class WhatsYourName { + public static void main(String[] args) + { + // Create Scanner + Scanner input = new Scanner(System.in); + + // Declare vars + String firstName, + lastName; + + // Prompt for input + System.out.print("What's your name? (Enter first and last) "); + firstName = input.next(); + lastName = input.next(); + + // Print output + System.out.println(firstName + " " + lastName + " is a beautiful name!"); + + } +}