diff --git a/MP1_CalebFontenot.zip b/MP1_CalebFontenot.zip new file mode 100644 index 0000000..3e6d4c4 Binary files /dev/null and b/MP1_CalebFontenot.zip differ diff --git a/MP1_CalebFontenot/HTML/CompoundValue.html b/MP1_CalebFontenot/HTML/CompoundValue.html new file mode 100644 index 0000000..63812fe --- /dev/null +++ b/MP1_CalebFontenot/HTML/CompoundValue.html @@ -0,0 +1,65 @@ + + + +CompoundValue.java + + + + +
/home/caleb/ASDV-Java/MP1_CalebFontenot/src/main/java/com/calebfontenot/mp1_calebfontenot/CompoundValue.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 com.calebfontenot.mp1_calebfontenot;
+
+import java.util.Scanner;
+
+/**
+ *
+ * @author caleb
+ */
+public class CompoundValue {
+
+    public static void main(String[] args) {
+        // Create Scanner
+        Scanner input = new Scanner(System.in);
+
+        // Define vars
+        int counter;
+        double SavingAmount;
+        double InterestRate;
+
+        // Prompt for input
+        System.out.print("Enter monthly saving amount: ");
+        SavingAmount = input.nextDouble();
+
+        // Compute and Print result
+        InterestRate = 0.05 / 12;
+        SavingAmount = SavingAmount * (1 + InterestRate);
+        System.out.println("The account is " + SavingAmount + " after month 1");
+        for (counter = 2; counter <= 6; counter++) {
+            SavingAmount = (100 + SavingAmount) * (1 + InterestRate);
+            System.out.println("The account is " + SavingAmount + " after month " + counter);
+        }
+    }
+}
+
+
+ diff --git a/MP1_CalebFontenot/HTML/Cylinder.html b/MP1_CalebFontenot/HTML/Cylinder.html new file mode 100644 index 0000000..34e2d30 --- /dev/null +++ b/MP1_CalebFontenot/HTML/Cylinder.html @@ -0,0 +1,57 @@ + + + +Cylinder.java + + + + +
/home/caleb/ASDV-Java/MP1_CalebFontenot/src/main/java/com/calebfontenot/mp1_calebfontenot/Cylinder.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 com.calebfontenot.mp1_calebfontenot;
+
+import java.util.Scanner;
+
+/**
+ *
+ * @author caleb
+ */
+public class Cylinder {
+    public static void main(String[] args)
+    {
+        Scanner input = new Scanner(System.in);
+        
+        // Enter radius of the cylinder
+        System.out.print("Enter the radius and length of a cylinder: ");
+        double radius = input.nextDouble();
+        double length = input.nextDouble();
+        
+        // Compute area and volume
+        double area = radius * radius * 3.14159;
+        double volume = area * length;
+        
+        // Display result
+        System.out.println("The area is " + area);
+        System.out.println("The volume of the cylinder is " + volume);
+        
+    }
+}
+
+
+ diff --git a/MP1_CalebFontenot/HTML/NumberOfYears.html b/MP1_CalebFontenot/HTML/NumberOfYears.html new file mode 100644 index 0000000..01b9530 --- /dev/null +++ b/MP1_CalebFontenot/HTML/NumberOfYears.html @@ -0,0 +1,93 @@ + + + +NumberOfYears.java + + + + +
/home/caleb/ASDV-Java/MP1_CalebFontenot/src/main/java/com/calebfontenot/mp1_calebfontenot/NumberOfYears.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 com.calebfontenot.mp1_calebfontenot;
+
+import java.util.Scanner;
+
+/**
+ *
+ * @author caleb
+ */
+public class NumberOfYears {
+
+    public static void main(String[] args)
+    {
+        // Define vars
+        double NumberOfMinutes;
+        double NumberOfYears;
+        double NumberOfDays;
+        double NumberOfHours;
+
+        // Create Scanner
+        Scanner input = new Scanner(System.in);
+
+        // Prompt for input
+        System.out.print("Enter the number of minutes: ");
+        NumberOfMinutes = input.nextDouble();
+
+        // Calculate
+        NumberOfHours = (NumberOfMinutes / 60);
+        NumberOfDays = (NumberOfHours / 24);
+        NumberOfYears = (NumberOfDays / 365);
+
+        // Big brain math time
+        //Subtract 365 from "NumberOfDays" until the number is less than or equal to 365
+        while (NumberOfDays >= 365.0) {
+            //System.out.println("DEBUG: Subtracting 365 from "+ NumberOfDays);
+            NumberOfDays = NumberOfDays - 365;
+        }
+
+        // Do the same with hours
+        while (NumberOfHours >= 24.0) {
+            //System.out.println("DEBUG: Subtracting 24 from "+ NumberOfHours);
+            NumberOfHours = NumberOfHours - 24;
+        }
+
+        // Print output
+        System.out.println((int) NumberOfMinutes + " minutes is approx. :");
+        if ((int)NumberOfYears >= 2) {
+            System.out.println((int) NumberOfYears + " years,");
+        } 
+        if ((int)NumberOfYears == 1) {
+            System.out.println((int)NumberOfYears+" year.");
+            }
+        if ((int) NumberOfDays != 0) {
+            System.out.println((int) NumberOfDays + " days,");
+        }
+        if ((int) NumberOfHours != 0) {
+            System.out.println((int) NumberOfHours + " hours.");
+        }
+
+    }
+}
+
+
+ diff --git a/MP1_CalebFontenot/HTML/SumOfDigits.html b/MP1_CalebFontenot/HTML/SumOfDigits.html new file mode 100644 index 0000000..bec9f1e --- /dev/null +++ b/MP1_CalebFontenot/HTML/SumOfDigits.html @@ -0,0 +1,59 @@ + + + +SumOfDigits.java + + + + +
/home/caleb/ASDV-Java/MP1_CalebFontenot/src/main/java/com/calebfontenot/mp1_calebfontenot/SumOfDigits.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 com.calebfontenot.mp1_calebfontenot;
+
+/**
+ *
+ * @author caleb
+ */
+public class SumOfDigits {
+    public static void main(String[] args)
+    {
+        java.util.Scanner input = new java.util.Scanner(System.in);
+        //> Read a number
+    System.out.print("Inter an integer between 0 and 1000: ");
+    int number = input.nextInt();
+    
+        //> Find all digits in number
+    int lastDigit = number % 10;
+    int remainingNumber = number / 10;
+    int secondLastDigit = remainingNumber % 10;
+    remainingNumber = remainingNumber / 10;
+    int thirdLastDigit = remainingNumber % 10;
+    
+        //> Obtain the sum of all digits
+    int sum = lastDigit + secondLastDigit + thirdLastDigit;
+    
+        //>Display results
+        System.out.println("The sum of all digits in "+ number
+        + " is " + sum);
+    }
+    
+}
+
+
+ diff --git a/MP1_CalebFontenot/HTML/Total.html b/MP1_CalebFontenot/HTML/Total.html new file mode 100644 index 0000000..d92b5f9 --- /dev/null +++ b/MP1_CalebFontenot/HTML/Total.html @@ -0,0 +1,65 @@ + + + +Total.java + + + + +
/home/caleb/ASDV-Java/MP1_CalebFontenot/src/main/java/com/calebfontenot/mp1_calebfontenot/Total.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 com.calebfontenot.mp1_calebfontenot;
+
+import java.util.Scanner;
+
+/**
+ *
+ * @author caleb
+ */
+public class Total {
+    public static void main(String[] args)
+    {
+        // Define variables:
+        double subtotal;
+        double gratuity;
+        double total;
+        
+        // Get subtotal and gratuity rate
+            // Setup Scanner
+        Scanner input = new Scanner(System.in);
+        
+            // Get vars
+        System.out.print("Enter subtotal and gratuity rate: ");
+        subtotal = input.nextDouble();
+        gratuity = input.nextDouble();
+        
+        // Calculate
+            // Convert gratuity into a decimal because its a percentage:
+        gratuity = (gratuity / 10); //* 10;
+        
+        total = (subtotal + gratuity);
+        
+        // Print result
+        System.out.println("The gratuity is $"+gratuity+" and the total is $"+total);
+        
+    }
+}
+
+
+ diff --git a/MP1_CalebFontenot/HTML/WindChill.html b/MP1_CalebFontenot/HTML/WindChill.html new file mode 100644 index 0000000..da22725 --- /dev/null +++ b/MP1_CalebFontenot/HTML/WindChill.html @@ -0,0 +1,58 @@ + + + +WindChill.java + + + + +
/home/caleb/ASDV-Java/MP1_CalebFontenot/src/main/java/com/calebfontenot/mp1_calebfontenot/WindChill.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 com.calebfontenot.mp1_calebfontenot;
+
+import java.util.Scanner;
+
+/**
+ *
+ * @author caleb
+ */
+public class WindChill {
+    public static void main(String[] args) {
+        Scanner input = new Scanner(System.in);
+            //> Enter the new temperature in Fahrenheit
+        System.out.print("Enter the temperature in Fahrenheit between -58∞F and 41∞F: ");
+        double fahrenheit = input.nextDouble();
+        
+            //> Enter the wind speed miles per hour
+        System.out.print("Enter the wind speed miles per hour "+
+                "(must be greater or equal to 2):");
+        double speed = input.nextDouble();
+        
+            //> Compute wind and chill index
+        double windChillIndex = 35.74 + 0.6215 * fahrenheit - 35.75
+                * Math.pow(speed, 0.16) + 0.4275 * fahrenheit
+                * Math.pow(speed, 0.16);
+        
+            //> Display the result
+        System.out.println("The wind chill index is "+ windChillIndex);
+    }
+}
+
+
+