diff --git a/Exams/ProgrammingExam1_CalebFontenot/LeapYear.html b/Exams/ProgrammingExam1_CalebFontenot/LeapYear.html new file mode 100755 index 0000000..8ea6d1e --- /dev/null +++ b/Exams/ProgrammingExam1_CalebFontenot/LeapYear.html @@ -0,0 +1,53 @@ + + + +LeapYear.java + + + + +
C:\Users\ar114\Documents\NetBeansProjects\ProgrammingExam1_CalebFontenot\src\programmingexam1_calebfontenot\LeapYear.java
+
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package programmingexam1_calebfontenot;
+
+import java.util.Scanner;
+
+/**
+ *
+ * @author ar114
+ */
+public class LeapYear {
+    public static void main(String[] args) {
+        Scanner input = new Scanner(System.in);
+        System.out.print("Enter a year: ");
+        int year = input.nextInt();
+        
+        // Check if the year is a leap year
+        boolean isLeapYear
+                = ((year % 4 == 0) && (year % 100 != 0 )|| (year % 400 == 0));
+        
+        // Display the result
+        System.out.println(year + " is a leap year? " + isLeapYear);
+    }
+}
+
+
+ diff --git a/Exams/ProgrammingExam1_CalebFontenot/QuotientAndRemainder.html b/Exams/ProgrammingExam1_CalebFontenot/QuotientAndRemainder.html new file mode 100755 index 0000000..5582b1f --- /dev/null +++ b/Exams/ProgrammingExam1_CalebFontenot/QuotientAndRemainder.html @@ -0,0 +1,63 @@ + + + +QuotientAndRemainder.java + + + + +
C:\Users\ar114\Documents\NetBeansProjects\ProgrammingExam1_CalebFontenot\src\programmingexam1_calebfontenot\QuotientAndRemainder.java
+
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package programmingexam1_calebfontenot;
+
+import java.util.Scanner;
+
+
+/**
+ *
+ * @author ar114
+ */
+public class QuotientAndRemainder {
+    public static void main(String[] args) {
+        // Define variables
+        int number1, number2, quotient, remainder;
+        
+        // Create scanner
+        Scanner input = new Scanner(System.in);
+        
+        // Prompt for variables
+        System.out.print("Enter 2 variables and I will calculate the "
+                + "quotient and the remainder: ");
+        number1 = input.nextInt();
+        number2 = input.nextInt();
+        
+        // Compute!
+        quotient = number1 / number2;
+        remainder = number1 % number2;
+        
+        // Print output:
+        System.out.println("The quotient is: " + quotient);
+        System.out.println("The remainder is: " + remainder);
+    }
+}
+
+
+ diff --git a/Exams/ProgrammingExam1_CalebFontenot/QuotientAndRemainderOfNumbersInAnyOrder.html b/Exams/ProgrammingExam1_CalebFontenot/QuotientAndRemainderOfNumbersInAnyOrder.html new file mode 100755 index 0000000..6a34c21 --- /dev/null +++ b/Exams/ProgrammingExam1_CalebFontenot/QuotientAndRemainderOfNumbersInAnyOrder.html @@ -0,0 +1,71 @@ + + + +QuotientAndRemainderOfNumbersInAnyOrder.java + + + + +
C:\Users\ar114\Documents\NetBeansProjects\ProgrammingExam1_CalebFontenot\src\programmingexam1_calebfontenot\QuotientAndRemainderOfNumbersInAnyOrder.java
+
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package programmingexam1_calebfontenot;
+
+import java.util.Scanner;
+
+
+/**
+ *
+ * @author ar114
+ */
+public class QuotientAndRemainderOfNumbersInAnyOrder {
+    public static void main(String[] args) {
+        // Define variables
+        int number1, number2, quotient, remainder;
+        
+        // Create scanner
+        Scanner input = new Scanner(System.in);
+        
+        // Prompt for variables
+        System.out.print("Enter 2 variables and I will calculate the "
+                + "quotient and the remainder: ");
+        number1 = input.nextInt();
+        number2 = input.nextInt();
+        
+        // Compute!
+        if (number1 <= number2) {
+            System.out.println(number1 + " < " + number2 + "!");
+            int tmp = number2; // temp variable to store the number
+            number2 = number1;
+            number1 = tmp;
+        }
+        
+        quotient = number1 / number2;
+        remainder = number1 % number2;
+        
+        // Print output:
+        System.out.println(number1 + " / " + number2 + " =");
+        System.out.println("The quotient is: " + quotient);
+        System.out.println("The remainder is: " + remainder);
+    }
+}
+
+
+ diff --git a/Exams/ProgrammingExam1_CalebFontenot/TwoLargerOfThe3.html b/Exams/ProgrammingExam1_CalebFontenot/TwoLargerOfThe3.html new file mode 100755 index 0000000..f82333b --- /dev/null +++ b/Exams/ProgrammingExam1_CalebFontenot/TwoLargerOfThe3.html @@ -0,0 +1,106 @@ + + + +TwoLargerOfThe3.java + + + + +
C:\Users\ar114\Documents\NetBeansProjects\ProgrammingExam1_CalebFontenot\src\programmingexam1_calebfontenot\TwoLargerOfThe3.java
+
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package programmingexam1_calebfontenot;
+
+import java.util.Scanner;
+
+/**
+ *
+ * @author ar114
+ */
+public class TwoLargerOfThe3 {
+
+    public static void main(String[] args) {
+        // Define vars
+        int _1, _2, _3; // Note to Markou: I find numbers easier to compare in my head than variables, hence my use of them here.
+        int firstLargest = 0, secondLargest = 0;
+
+        // Setup scanner
+        Scanner input = new Scanner(System.in);
+        while (true) {
+            // Prompt for input
+            System.out.print("Enter 3 numbers: ");
+            _1 = input.nextInt();
+            _2 = input.nextInt();
+            _3 = input.nextInt();
+
+            // Compute!
+            if (_1 <= _3 & _2 <= _3) { // Is _3 the largest?
+                firstLargest = _3; // Yes!
+                if (_2 >= _1) { // Is _2 larger than _1?
+                    secondLargest = _2; //Then _2 must be the second largest.
+                } else {
+                    secondLargest = _1; //Then _1 must be the second largest.
+                }
+            }
+            if (_3 <= _2 & _1 <= _2) { // Is _2 the largest?
+                firstLargest = _2; // Yes!
+                if (_3 >= _1) { //Is _3 larger than _1?
+                    secondLargest = _3; // Then _3 must be the largest.
+                } else {
+                    secondLargest = _1; // Then _1 must be the largest.
+                }
+            }
+            if (_3 <= _1 & _2 <= _1) { // Is _1 the largest?
+                firstLargest = _1; // Yes!
+                if (_3 >= _2) {// Is _3 larger than _2?
+                    secondLargest = _3; // Then _3 must be the largest.
+                } else {
+                    secondLargest = _2; // Then _2 must be the largest.
+                }
+            }
+            if (_1 == _2 | _1 == _3 | _2 == _3) {
+                System.out.println("Some numbers equal. Running additional checks...");
+                if (_1 == _2) {
+                    if (_1 > _3) { // Is _3 smaller than _1 and _2?
+                        firstLargest = _1;
+                        secondLargest = _3;
+                    }
+                }
+                if (_1 == _3) {
+                    if (_3 > _2) { // Is _2 smaller than _1 and _3? 
+                        firstLargest = _3;
+                        secondLargest = _2;
+                    }
+                }
+                if (_2 == _3) {
+                    if (_3 > _1) { // Is _1 smaller than _2 or _3?
+                        firstLargest = _3;
+                        secondLargest = _1;
+                    }
+                }
+            }
+            // Output
+            System.out.println("The first largest is " + firstLargest + " and the second largest is " + secondLargest);
+        }
+    }
+}
+
+
+ diff --git a/Exams/ProgrammingExam1_CalebFontenot/build.xml b/Exams/ProgrammingExam1_CalebFontenot/build.xml new file mode 100755 index 0000000..1f693a5 --- /dev/null +++ b/Exams/ProgrammingExam1_CalebFontenot/build.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + Builds, tests, and runs the project ProgrammingExam1_CalebFontenot. + + + diff --git a/Exams/ProgrammingExam1_CalebFontenot/build/classes/.netbeans_automatic_build b/Exams/ProgrammingExam1_CalebFontenot/build/classes/.netbeans_automatic_build new file mode 100755 index 0000000..e69de29 diff --git a/Exams/ProgrammingExam1_CalebFontenot/build/classes/.netbeans_update_resources b/Exams/ProgrammingExam1_CalebFontenot/build/classes/.netbeans_update_resources new file mode 100755 index 0000000..e69de29 diff --git a/Exams/ProgrammingExam1_CalebFontenot/build/classes/programmingexam1_calebfontenot/LeapYear.class b/Exams/ProgrammingExam1_CalebFontenot/build/classes/programmingexam1_calebfontenot/LeapYear.class new file mode 100755 index 0000000..e4096c0 Binary files /dev/null and b/Exams/ProgrammingExam1_CalebFontenot/build/classes/programmingexam1_calebfontenot/LeapYear.class differ diff --git a/Exams/ProgrammingExam1_CalebFontenot/build/classes/programmingexam1_calebfontenot/ProgrammingExam1_CalebFontenot.class b/Exams/ProgrammingExam1_CalebFontenot/build/classes/programmingexam1_calebfontenot/ProgrammingExam1_CalebFontenot.class new file mode 100755 index 0000000..62293b9 Binary files /dev/null and b/Exams/ProgrammingExam1_CalebFontenot/build/classes/programmingexam1_calebfontenot/ProgrammingExam1_CalebFontenot.class differ diff --git a/Exams/ProgrammingExam1_CalebFontenot/build/classes/programmingexam1_calebfontenot/QuotientAndRemainder.class b/Exams/ProgrammingExam1_CalebFontenot/build/classes/programmingexam1_calebfontenot/QuotientAndRemainder.class new file mode 100755 index 0000000..146ebbe Binary files /dev/null and b/Exams/ProgrammingExam1_CalebFontenot/build/classes/programmingexam1_calebfontenot/QuotientAndRemainder.class differ diff --git a/Exams/ProgrammingExam1_CalebFontenot/build/classes/programmingexam1_calebfontenot/QuotientAndRemainderOfNumbersInAnyOrder.class b/Exams/ProgrammingExam1_CalebFontenot/build/classes/programmingexam1_calebfontenot/QuotientAndRemainderOfNumbersInAnyOrder.class new file mode 100755 index 0000000..eeee34d Binary files /dev/null and b/Exams/ProgrammingExam1_CalebFontenot/build/classes/programmingexam1_calebfontenot/QuotientAndRemainderOfNumbersInAnyOrder.class differ diff --git a/Exams/ProgrammingExam1_CalebFontenot/build/classes/programmingexam1_calebfontenot/TwoLargerOfThe3.class b/Exams/ProgrammingExam1_CalebFontenot/build/classes/programmingexam1_calebfontenot/TwoLargerOfThe3.class new file mode 100755 index 0000000..bcd999c Binary files /dev/null and b/Exams/ProgrammingExam1_CalebFontenot/build/classes/programmingexam1_calebfontenot/TwoLargerOfThe3.class differ diff --git a/Exams/ProgrammingExam1_CalebFontenot/manifest.mf b/Exams/ProgrammingExam1_CalebFontenot/manifest.mf new file mode 100755 index 0000000..1574df4 --- /dev/null +++ b/Exams/ProgrammingExam1_CalebFontenot/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +X-COMMENT: Main-Class will be added automatically by build + diff --git a/Exams/ProgrammingExam1_CalebFontenot/nbproject/build-impl.xml b/Exams/ProgrammingExam1_CalebFontenot/nbproject/build-impl.xml new file mode 100755 index 0000000..2f7f510 --- /dev/null +++ b/Exams/ProgrammingExam1_CalebFontenot/nbproject/build-impl.xml @@ -0,0 +1,1420 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + Must select one file in the IDE or set profile.class + This target only works when run from inside the NetBeans IDE. + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + Must select some files in the IDE or set test.includes + + + + + Must select one file in the IDE or set run.class + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Exams/ProgrammingExam1_CalebFontenot/nbproject/genfiles.properties b/Exams/ProgrammingExam1_CalebFontenot/nbproject/genfiles.properties new file mode 100755 index 0000000..77bc7e6 --- /dev/null +++ b/Exams/ProgrammingExam1_CalebFontenot/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=bc1262b2 +build.xml.script.CRC32=17222dbe +build.xml.stylesheet.CRC32=8064a381@1.80.1.48 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=bc1262b2 +nbproject/build-impl.xml.script.CRC32=3fba722a +nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 diff --git a/Exams/ProgrammingExam1_CalebFontenot/nbproject/private/private.properties b/Exams/ProgrammingExam1_CalebFontenot/nbproject/private/private.properties new file mode 100755 index 0000000..40ab0ca --- /dev/null +++ b/Exams/ProgrammingExam1_CalebFontenot/nbproject/private/private.properties @@ -0,0 +1,2 @@ +compile.on.save=true +user.properties.file=C:\\Users\\ar114\\AppData\\Roaming\\NetBeans\\8.2\\build.properties diff --git a/Exams/ProgrammingExam1_CalebFontenot/nbproject/private/private.xml b/Exams/ProgrammingExam1_CalebFontenot/nbproject/private/private.xml new file mode 100755 index 0000000..a714ebf --- /dev/null +++ b/Exams/ProgrammingExam1_CalebFontenot/nbproject/private/private.xml @@ -0,0 +1,13 @@ + + + + + + file:/C:/Users/ar114/Documents/NetBeansProjects/ProgrammingExam1_CalebFontenot/src/programmingexam1_calebfontenot/TwoLargerOfThe3.java + file:/C:/Users/ar114/Documents/NetBeansProjects/ProgrammingExam1_CalebFontenot/src/programmingexam1_calebfontenot/ProgrammingExam1_CalebFontenot.java + file:/C:/Users/ar114/Documents/NetBeansProjects/ProgrammingExam1_CalebFontenot/src/programmingexam1_calebfontenot/QuotientAndRemainderOfNumbersInAnyOrder.java + file:/C:/Users/ar114/Documents/NetBeansProjects/ProgrammingExam1_CalebFontenot/src/programmingexam1_calebfontenot/LeapYear.java + file:/C:/Users/ar114/Documents/NetBeansProjects/ProgrammingExam1_CalebFontenot/src/programmingexam1_calebfontenot/QuotientAndRemainder.java + + + diff --git a/Exams/ProgrammingExam1_CalebFontenot/nbproject/project.properties b/Exams/ProgrammingExam1_CalebFontenot/nbproject/project.properties new file mode 100755 index 0000000..685eb71 --- /dev/null +++ b/Exams/ProgrammingExam1_CalebFontenot/nbproject/project.properties @@ -0,0 +1,74 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=false +annotation.processing.processor.options= +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# Files in build.classes.dir which should be excluded from distribution jar +dist.archive.excludes= +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/ProgrammingExam1_CalebFontenot.jar +dist.javadoc.dir=${dist.dir}/javadoc +excludes= +includes=** +jar.compress=false +javac.classpath= +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.external.vm=true +javac.processorpath=\ + ${javac.classpath} +javac.source=1.8 +javac.target=1.8 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +main.class=programmingexam1_calebfontenot.ProgrammingExam1_CalebFontenot +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=false +platform.active=default_platform +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project. +# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. +# To set system properties for unit tests define test-sys-prop.name=value: +run.jvmargs= +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +source.encoding=UTF-8 +src.dir=src +test.src.dir=test diff --git a/Exams/ProgrammingExam1_CalebFontenot/nbproject/project.xml b/Exams/ProgrammingExam1_CalebFontenot/nbproject/project.xml new file mode 100755 index 0000000..908476b --- /dev/null +++ b/Exams/ProgrammingExam1_CalebFontenot/nbproject/project.xml @@ -0,0 +1,15 @@ + + + org.netbeans.modules.java.j2seproject + + + ProgrammingExam1_CalebFontenot + + + + + + + + + diff --git a/Exams/ProgrammingExam1_CalebFontenot/src/programmingexam1_calebfontenot/LeapYear.java b/Exams/ProgrammingExam1_CalebFontenot/src/programmingexam1_calebfontenot/LeapYear.java new file mode 100755 index 0000000..efd629f --- /dev/null +++ b/Exams/ProgrammingExam1_CalebFontenot/src/programmingexam1_calebfontenot/LeapYear.java @@ -0,0 +1,27 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package programmingexam1_calebfontenot; + +import java.util.Scanner; + +/** + * + * @author ar114 + */ +public class LeapYear { + public static void main(String[] args) { + Scanner input = new Scanner(System.in); + System.out.print("Enter a year: "); + int year = input.nextInt(); + + // Check if the year is a leap year + boolean isLeapYear + = ((year % 4 == 0) && (year % 100 != 0 )|| (year % 400 == 0)); + + // Display the result + System.out.println(year + " is a leap year? " + isLeapYear); + } +} diff --git a/Exams/ProgrammingExam1_CalebFontenot/src/programmingexam1_calebfontenot/ProgrammingExam1_CalebFontenot.java b/Exams/ProgrammingExam1_CalebFontenot/src/programmingexam1_calebfontenot/ProgrammingExam1_CalebFontenot.java new file mode 100755 index 0000000..356dfa0 --- /dev/null +++ b/Exams/ProgrammingExam1_CalebFontenot/src/programmingexam1_calebfontenot/ProgrammingExam1_CalebFontenot.java @@ -0,0 +1,21 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package programmingexam1_calebfontenot; + +/** + * + * @author ar114 + */ +public class ProgrammingExam1_CalebFontenot { + + /** + * @param args the command line arguments + */ + public static void main(String[] args) { + // TODO code application logic here + } + +} diff --git a/Exams/ProgrammingExam1_CalebFontenot/src/programmingexam1_calebfontenot/QuotientAndRemainder.java b/Exams/ProgrammingExam1_CalebFontenot/src/programmingexam1_calebfontenot/QuotientAndRemainder.java new file mode 100755 index 0000000..2b35e51 --- /dev/null +++ b/Exams/ProgrammingExam1_CalebFontenot/src/programmingexam1_calebfontenot/QuotientAndRemainder.java @@ -0,0 +1,37 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package programmingexam1_calebfontenot; + +import java.util.Scanner; + + +/** + * + * @author ar114 + */ +public class QuotientAndRemainder { + public static void main(String[] args) { + // Define variables + int number1, number2, quotient, remainder; + + // Create scanner + Scanner input = new Scanner(System.in); + + // Prompt for variables + System.out.print("Enter 2 variables and I will calculate the " + + "quotient and the remainder: "); + number1 = input.nextInt(); + number2 = input.nextInt(); + + // Compute! + quotient = number1 / number2; + remainder = number1 % number2; + + // Print output: + System.out.println("The quotient is: " + quotient); + System.out.println("The remainder is: " + remainder); + } +} diff --git a/Exams/ProgrammingExam1_CalebFontenot/src/programmingexam1_calebfontenot/QuotientAndRemainderOfNumbersInAnyOrder.java b/Exams/ProgrammingExam1_CalebFontenot/src/programmingexam1_calebfontenot/QuotientAndRemainderOfNumbersInAnyOrder.java new file mode 100755 index 0000000..5191bc9 --- /dev/null +++ b/Exams/ProgrammingExam1_CalebFontenot/src/programmingexam1_calebfontenot/QuotientAndRemainderOfNumbersInAnyOrder.java @@ -0,0 +1,45 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package programmingexam1_calebfontenot; + +import java.util.Scanner; + + +/** + * + * @author ar114 + */ +public class QuotientAndRemainderOfNumbersInAnyOrder { + public static void main(String[] args) { + // Define variables + int number1, number2, quotient, remainder; + + // Create scanner + Scanner input = new Scanner(System.in); + + // Prompt for variables + System.out.print("Enter 2 variables and I will calculate the " + + "quotient and the remainder: "); + number1 = input.nextInt(); + number2 = input.nextInt(); + + // Compute! + if (number1 <= number2) { + System.out.println(number1 + " < " + number2 + "!"); + int tmp = number2; // temp variable to store the number + number2 = number1; + number1 = tmp; + } + + quotient = number1 / number2; + remainder = number1 % number2; + + // Print output: + System.out.println(number1 + " / " + number2 + " ="); + System.out.println("The quotient is: " + quotient); + System.out.println("The remainder is: " + remainder); + } +} diff --git a/Exams/ProgrammingExam1_CalebFontenot/src/programmingexam1_calebfontenot/TwoLargerOfThe3.java b/Exams/ProgrammingExam1_CalebFontenot/src/programmingexam1_calebfontenot/TwoLargerOfThe3.java new file mode 100755 index 0000000..2fbe16d --- /dev/null +++ b/Exams/ProgrammingExam1_CalebFontenot/src/programmingexam1_calebfontenot/TwoLargerOfThe3.java @@ -0,0 +1,80 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package programmingexam1_calebfontenot; + +import java.util.Scanner; + +/** + * + * @author ar114 + */ +public class TwoLargerOfThe3 { + + public static void main(String[] args) { + // Define vars + int _1, _2, _3; // Note to Markou: I find numbers easier to compare in my head than variables, hence my use of them here. + int firstLargest = 0, secondLargest = 0; + + // Setup scanner + Scanner input = new Scanner(System.in); + while (true) { + // Prompt for input + System.out.print("Enter 3 numbers: "); + _1 = input.nextInt(); + _2 = input.nextInt(); + _3 = input.nextInt(); + + // Compute! + if (_1 <= _3 & _2 <= _3) { // Is _3 the largest? + firstLargest = _3; // Yes! + if (_2 >= _1) { // Is _2 larger than _1? + secondLargest = _2; //Then _2 must be the second largest. + } else { + secondLargest = _1; //Then _1 must be the second largest. + } + } + if (_3 <= _2 & _1 <= _2) { // Is _2 the largest? + firstLargest = _2; // Yes! + if (_3 >= _1) { //Is _3 larger than _1? + secondLargest = _3; // Then _3 must be the largest. + } else { + secondLargest = _1; // Then _1 must be the largest. + } + } + if (_3 <= _1 & _2 <= _1) { // Is _1 the largest? + firstLargest = _1; // Yes! + if (_3 >= _2) {// Is _3 larger than _2? + secondLargest = _3; // Then _3 must be the largest. + } else { + secondLargest = _2; // Then _2 must be the largest. + } + } + if (_1 == _2 | _1 == _3 | _2 == _3) { + System.out.println("Some numbers equal. Running additional checks..."); + if (_1 == _2) { + if (_1 > _3) { // Is _3 smaller than _1 and _2? + firstLargest = _1; + secondLargest = _3; + } + } + if (_1 == _3) { + if (_3 > _2) { // Is _2 smaller than _1 and _3? + firstLargest = _3; + secondLargest = _2; + } + } + if (_2 == _3) { + if (_3 > _1) { // Is _1 smaller than _2 or _3? + firstLargest = _3; + secondLargest = _1; + } + } + } + // Output + System.out.println("The first largest is " + firstLargest + " and the second largest is " + secondLargest); + } + } +} diff --git a/ZIPs/ProgrammingExam1_CalebFontenot.zip b/ZIPs/ProgrammingExam1_CalebFontenot.zip new file mode 100755 index 0000000..bd228cb Binary files /dev/null and b/ZIPs/ProgrammingExam1_CalebFontenot.zip differ