diff --git a/.gitignore b/.gitignore index 9aa5929..b54dff1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /lab4_CalebFontenot/target/ /lab5_CalebFontenot/target/ +/LabClass_Sep6_CalebFontenot/target/ diff --git a/LabClass_Sep6_CalebFontenot/pom.xml b/LabClass_Sep6_CalebFontenot/pom.xml new file mode 100644 index 0000000..95a5ccb --- /dev/null +++ b/LabClass_Sep6_CalebFontenot/pom.xml @@ -0,0 +1,14 @@ + + + 4.0.0 + com.calebfontenot.labclass_sep6_calebfontenot + LabClass_Sep6_CalebFontenot + 1.0-SNAPSHOT + jar + + UTF-8 + 18 + 18 + com.calebfontenot.labclass_sep6_calebfontenot.LabClass_Sep6_CalebFontenot + + \ No newline at end of file diff --git a/LabClass_Sep6_CalebFontenot/src/main/java/com/calebfontenot/labclass_sep6_calebfontenot/ComputeTax.java b/LabClass_Sep6_CalebFontenot/src/main/java/com/calebfontenot/labclass_sep6_calebfontenot/ComputeTax.java new file mode 100644 index 0000000..593f371 --- /dev/null +++ b/LabClass_Sep6_CalebFontenot/src/main/java/com/calebfontenot/labclass_sep6_calebfontenot/ComputeTax.java @@ -0,0 +1,68 @@ +/* + * 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.labclass_sep6_calebfontenot; + +/** + * + * @author caleb + */ +import java.util.Scanner; + +public class ComputeTax { + + public static void main(String[] args) + { + // Create a Scanner + Scanner input = new Scanner(System.in); + + // Prompt the user to enter filing status + System.out.print("(0-single filer, 1-married jointly or " + + "qualifying widow(er), 2-married separately, 3-head of " + + "household) Enter the filing status: "); + + int status = input.nextInt(); + + // Prompt the user to enter taxable income + System.out.print("Enter the taxable income: "); + double income = input.nextDouble(); + + // Compute tax + double tax = 0; + + if (status == 0) { // Compute tax for single filers + if (income <= 8350) { + tax = income * 0.10; + } else if (income <= 33950) { + tax = 8350 * 0.10 + (income - 8350) * 0.15; + } else if (income <= 82250) { + tax = 8350 * 0.10 + (33950 - 8350) * 0.15 + + (income - 33950) * 0.25; + } else if (income <= 171550) { + tax = 8350 * 0.10 + (33950 - 8350) * 0.15 + + (82250 - 33950) * 0.25 + (income - 82250) * 0.28; + } else if (income <= 372950) { + tax = 8350 * 0.10 + (33950 - 8350) * 0.15 + + (82250 - 33950) * 0.25 + (171550 - 82250) * 0.28 + + (income - 171550) * 0.33; + } else { + tax = 8350 * 0.10 + (33950 - 8350) * 0.15 + + (82250 - 33950) * 0.25 + (171550 - 82250) * 0.28 + + (372950 - 171550) * 0.33 + (income - 372950) * 0.35; + } + } else if (status == 1) { // Compute tax for married file jointly + // Left as exercise in Programming Exercise 3.13 + } else if (status == 2) { // Compute tax for married separately + // Left as exercise in Programming Exercise 3.13 + } else if (status == 3) { // Compute tax for head of household + // Left as exercise in Programming Exercise 3.13 + } else { + System.out.println("Error: invalid status"); + System.exit(1); + } + + // Display the result + System.out.println("Tax is " + (int) (tax * 100) / 100.0); + } +} diff --git a/LabClass_Sep6_CalebFontenot/src/main/java/com/calebfontenot/labclass_sep6_calebfontenot/LabClass_Sep6_CalebFontenot.java b/LabClass_Sep6_CalebFontenot/src/main/java/com/calebfontenot/labclass_sep6_calebfontenot/LabClass_Sep6_CalebFontenot.java new file mode 100644 index 0000000..1072a29 --- /dev/null +++ b/LabClass_Sep6_CalebFontenot/src/main/java/com/calebfontenot/labclass_sep6_calebfontenot/LabClass_Sep6_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.labclass_sep6_calebfontenot; + +/** + * + * @author caleb + */ +public class LabClass_Sep6_CalebFontenot { + + public static void main(String[] args) { + System.out.println("Hello World!"); + } +} diff --git a/LabClass_Sep6_CalebFontenot/src/main/java/com/calebfontenot/labclass_sep6_calebfontenot/SimpleIfDemo.java b/LabClass_Sep6_CalebFontenot/src/main/java/com/calebfontenot/labclass_sep6_calebfontenot/SimpleIfDemo.java new file mode 100644 index 0000000..6492a17 --- /dev/null +++ b/LabClass_Sep6_CalebFontenot/src/main/java/com/calebfontenot/labclass_sep6_calebfontenot/SimpleIfDemo.java @@ -0,0 +1,29 @@ +/* + * 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.labclass_sep6_calebfontenot; + +import java.util.Scanner; + +/** + * + * @author caleb + */ +public class SimpleIfDemo { + + public static void main(String[] args) + { + Scanner input = new Scanner(System.in); + System.out.print("Enter an integer: "); + int number = input.nextInt(); + + if (number % 5 == 0) { + System.out.println("HiFive"); + } + + if (number % 2 == 0) { + System.out.println("HiEven"); + } + } +} diff --git a/MP1_CalebFontenot/target/classes/.netbeans_automatic_build b/MP1_CalebFontenot/target/classes/.netbeans_automatic_build new file mode 100644 index 0000000..e69de29 diff --git a/MP1_CalebFontenot/target/test-classes/.netbeans_automatic_build b/MP1_CalebFontenot/target/test-classes/.netbeans_automatic_build new file mode 100644 index 0000000..e69de29 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 index c0fdf31..f51bafe 100644 --- a/lab5_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/Operators.java +++ b/lab5_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/Operators.java @@ -38,7 +38,7 @@ public class Operators { expression to evaluate 2.0. Assign the evaluation to varible z3 */ - double z3 = ((double) x /(double) y * --d); + double z3 = ((double) x /(double) y * (d - 1)); //add code here System.out.println("z3: "+ z3 ); diff --git a/lab5_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/WhatsYourSSN.java b/lab5_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/WhatsYourSSN.java new file mode 100644 index 0000000..001c6c2 --- /dev/null +++ b/lab5_CalebFontenot/src/main/java/com/calebfontenot/lab5_calebfontenot/WhatsYourSSN.java @@ -0,0 +1,29 @@ +/* + * 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 WhatsYourSSN { + public static void main(String[] args) + { + // Create Scanner + Scanner input = new Scanner(System.in); + + // Declare vars + String ssn; + + // Prompt for input + System.out.print("What's your SSN? "); + ssn = input.next(); + + // Print output + System.out.println(ssn + " is your SSN."); + } +}