Upload Exam1
This commit is contained in:
parent
cba0c80bb4
commit
eeb19bba52
53
Exams/ProgrammingExam1_CalebFontenot/LeapYear.html
Executable file
53
Exams/ProgrammingExam1_CalebFontenot/LeapYear.html
Executable file
@ -0,0 +1,53 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>LeapYear.java</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
body {color: #000000; background-color: #ffffff; font-family: Monospaced}
|
||||
pre {color: #000000; background-color: #ffffff; font-family: Monospaced}
|
||||
table {color: #000000; background-color: #e9e8e2; font-family: Monospaced}
|
||||
.ST0 {color: #969696; font-family: Monospaced; font-weight: bold}
|
||||
.ST1 {font-family: Monospaced; font-weight: bold}
|
||||
.comment {color: #969696}
|
||||
.ST2 {font-family: Monospaced; font-weight: bold; font-style: italic}
|
||||
.ST3 {color: #009900; font-family: Monospaced; font-style: italic}
|
||||
.literal {color: #0000e6}
|
||||
.string {color: #ce7b00}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table width="100%"><tr><td align="center">C:\Users\ar114\Documents\NetBeansProjects\ProgrammingExam1_CalebFontenot\src\programmingexam1_calebfontenot\LeapYear.java</td></tr></table>
|
||||
<pre>
|
||||
<span class="comment">/*</span>
|
||||
<span class="comment"> * To change this license header, choose License Headers in Project Properties.</span>
|
||||
<span class="comment"> * To change this template file, choose Tools | Templates</span>
|
||||
<span class="comment"> * and open the template in the editor.</span>
|
||||
<span class="comment"> */</span>
|
||||
<span class="literal">package</span> programmingexam1_calebfontenot;
|
||||
|
||||
<span class="literal">import</span> java.util.Scanner;
|
||||
|
||||
<span class="comment">/**</span>
|
||||
<span class="comment"> *</span>
|
||||
<span class="comment"> * </span><span class="ST0">@author</span> <span class="comment">ar114</span>
|
||||
<span class="comment">*/</span>
|
||||
<span class="literal">public</span> <span class="literal">class</span> <span class="ST1">LeapYear</span> {
|
||||
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST2">main</span>(String[] args) {
|
||||
Scanner input = <span class="literal">new</span> Scanner(System.<span class="ST3">in</span>);
|
||||
System.<span class="ST3">out</span>.print(<span class="string">"</span><span class="string">Enter a year: </span><span class="string">"</span>);
|
||||
<span class="literal">int</span> year = input.nextInt();
|
||||
|
||||
<span class="comment">// Check if the year is a leap year</span>
|
||||
<span class="literal">boolean</span> isLeapYear
|
||||
= ((year % 4 == 0) && (year % 100 != 0 )|| (year % 400 == 0));
|
||||
|
||||
<span class="comment">// Display the result</span>
|
||||
System.<span class="ST3">out</span>.println(year + <span class="string">"</span><span class="string"> is a leap year? </span><span class="string">"</span> + isLeapYear);
|
||||
}
|
||||
}
|
||||
|
||||
</pre></body>
|
||||
</html>
|
63
Exams/ProgrammingExam1_CalebFontenot/QuotientAndRemainder.html
Executable file
63
Exams/ProgrammingExam1_CalebFontenot/QuotientAndRemainder.html
Executable file
@ -0,0 +1,63 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>QuotientAndRemainder.java</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
body {color: #000000; background-color: #ffffff; font-family: Monospaced}
|
||||
pre {color: #000000; background-color: #ffffff; font-family: Monospaced}
|
||||
table {color: #000000; background-color: #e9e8e2; font-family: Monospaced}
|
||||
.ST0 {color: #969696; font-family: Monospaced; font-weight: bold}
|
||||
.ST1 {font-family: Monospaced; font-weight: bold}
|
||||
.comment {color: #969696}
|
||||
.ST2 {font-family: Monospaced; font-weight: bold; font-style: italic}
|
||||
.ST3 {color: #009900; font-family: Monospaced; font-style: italic}
|
||||
.literal {color: #0000e6}
|
||||
.string {color: #ce7b00}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table width="100%"><tr><td align="center">C:\Users\ar114\Documents\NetBeansProjects\ProgrammingExam1_CalebFontenot\src\programmingexam1_calebfontenot\QuotientAndRemainder.java</td></tr></table>
|
||||
<pre>
|
||||
<span class="comment">/*</span>
|
||||
<span class="comment"> * To change this license header, choose License Headers in Project Properties.</span>
|
||||
<span class="comment"> * To change this template file, choose Tools | Templates</span>
|
||||
<span class="comment"> * and open the template in the editor.</span>
|
||||
<span class="comment"> */</span>
|
||||
<span class="literal">package</span> programmingexam1_calebfontenot;
|
||||
|
||||
<span class="literal">import</span> java.util.Scanner;
|
||||
|
||||
|
||||
<span class="comment">/**</span>
|
||||
<span class="comment"> *</span>
|
||||
<span class="comment"> * </span><span class="ST0">@author</span> <span class="comment">ar114</span>
|
||||
<span class="comment">*/</span>
|
||||
<span class="literal">public</span> <span class="literal">class</span> <span class="ST1">QuotientAndRemainder</span> {
|
||||
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST2">main</span>(String[] args) {
|
||||
<span class="comment">// Define variables</span>
|
||||
<span class="literal">int</span> number1, number2, quotient, remainder;
|
||||
|
||||
<span class="comment">// Create scanner</span>
|
||||
Scanner input = <span class="literal">new</span> Scanner(System.<span class="ST3">in</span>);
|
||||
|
||||
<span class="comment">// Prompt for variables</span>
|
||||
System.<span class="ST3">out</span>.print(<span class="string">"</span><span class="string">Enter 2 variables and I will calculate the </span><span class="string">"</span>
|
||||
+ <span class="string">"</span><span class="string">quotient and the remainder: </span><span class="string">"</span>);
|
||||
number1 = input.nextInt();
|
||||
number2 = input.nextInt();
|
||||
|
||||
<span class="comment">// Compute!</span>
|
||||
quotient = number1 / number2;
|
||||
remainder = number1 % number2;
|
||||
|
||||
<span class="comment">// Print output:</span>
|
||||
System.<span class="ST3">out</span>.println(<span class="string">"</span><span class="string">The quotient is: </span><span class="string">"</span> + quotient);
|
||||
System.<span class="ST3">out</span>.println(<span class="string">"</span><span class="string">The remainder is: </span><span class="string">"</span> + remainder);
|
||||
}
|
||||
}
|
||||
|
||||
</pre></body>
|
||||
</html>
|
@ -0,0 +1,71 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>QuotientAndRemainderOfNumbersInAnyOrder.java</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
body {color: #000000; background-color: #ffffff; font-family: Monospaced}
|
||||
pre {color: #000000; background-color: #ffffff; font-family: Monospaced}
|
||||
table {color: #000000; background-color: #e9e8e2; font-family: Monospaced}
|
||||
.ST0 {color: #969696; font-family: Monospaced; font-weight: bold}
|
||||
.ST1 {font-family: Monospaced; font-weight: bold}
|
||||
.comment {color: #969696}
|
||||
.ST2 {font-family: Monospaced; font-weight: bold; font-style: italic}
|
||||
.ST3 {color: #009900; font-family: Monospaced; font-style: italic}
|
||||
.literal {color: #0000e6}
|
||||
.string {color: #ce7b00}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table width="100%"><tr><td align="center">C:\Users\ar114\Documents\NetBeansProjects\ProgrammingExam1_CalebFontenot\src\programmingexam1_calebfontenot\QuotientAndRemainderOfNumbersInAnyOrder.java</td></tr></table>
|
||||
<pre>
|
||||
<span class="comment">/*</span>
|
||||
<span class="comment"> * To change this license header, choose License Headers in Project Properties.</span>
|
||||
<span class="comment"> * To change this template file, choose Tools | Templates</span>
|
||||
<span class="comment"> * and open the template in the editor.</span>
|
||||
<span class="comment"> */</span>
|
||||
<span class="literal">package</span> programmingexam1_calebfontenot;
|
||||
|
||||
<span class="literal">import</span> java.util.Scanner;
|
||||
|
||||
|
||||
<span class="comment">/**</span>
|
||||
<span class="comment"> *</span>
|
||||
<span class="comment"> * </span><span class="ST0">@author</span> <span class="comment">ar114</span>
|
||||
<span class="comment">*/</span>
|
||||
<span class="literal">public</span> <span class="literal">class</span> <span class="ST1">QuotientAndRemainderOfNumbersInAnyOrder</span> {
|
||||
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST2">main</span>(String[] args) {
|
||||
<span class="comment">// Define variables</span>
|
||||
<span class="literal">int</span> number1, number2, quotient, remainder;
|
||||
|
||||
<span class="comment">// Create scanner</span>
|
||||
Scanner input = <span class="literal">new</span> Scanner(System.<span class="ST3">in</span>);
|
||||
|
||||
<span class="comment">// Prompt for variables</span>
|
||||
System.<span class="ST3">out</span>.print(<span class="string">"</span><span class="string">Enter 2 variables and I will calculate the </span><span class="string">"</span>
|
||||
+ <span class="string">"</span><span class="string">quotient and the remainder: </span><span class="string">"</span>);
|
||||
number1 = input.nextInt();
|
||||
number2 = input.nextInt();
|
||||
|
||||
<span class="comment">// Compute!</span>
|
||||
<span class="literal">if</span> (number1 <= number2) {
|
||||
System.<span class="ST3">out</span>.println(number1 + <span class="string">"</span><span class="string"> < </span><span class="string">"</span> + number2 + <span class="string">"</span><span class="string">!</span><span class="string">"</span>);
|
||||
<span class="literal">int</span> tmp = number2; <span class="comment">// temp variable to store the number</span>
|
||||
number2 = number1;
|
||||
number1 = tmp;
|
||||
}
|
||||
|
||||
quotient = number1 / number2;
|
||||
remainder = number1 % number2;
|
||||
|
||||
<span class="comment">// Print output:</span>
|
||||
System.<span class="ST3">out</span>.println(number1 + <span class="string">"</span><span class="string"> / </span><span class="string">"</span> + number2 + <span class="string">"</span><span class="string"> =</span><span class="string">"</span>);
|
||||
System.<span class="ST3">out</span>.println(<span class="string">"</span><span class="string">The quotient is: </span><span class="string">"</span> + quotient);
|
||||
System.<span class="ST3">out</span>.println(<span class="string">"</span><span class="string">The remainder is: </span><span class="string">"</span> + remainder);
|
||||
}
|
||||
}
|
||||
|
||||
</pre></body>
|
||||
</html>
|
106
Exams/ProgrammingExam1_CalebFontenot/TwoLargerOfThe3.html
Executable file
106
Exams/ProgrammingExam1_CalebFontenot/TwoLargerOfThe3.html
Executable file
@ -0,0 +1,106 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>TwoLargerOfThe3.java</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
body {color: #000000; background-color: #ffffff; font-family: Monospaced}
|
||||
pre {color: #000000; background-color: #ffffff; font-family: Monospaced}
|
||||
table {color: #000000; background-color: #e9e8e2; font-family: Monospaced}
|
||||
.ST0 {color: #969696; font-family: Monospaced; font-weight: bold}
|
||||
.ST1 {font-family: Monospaced; font-weight: bold}
|
||||
.comment {color: #969696}
|
||||
.ST2 {font-family: Monospaced; font-weight: bold; font-style: italic}
|
||||
.ST3 {color: #009900; font-family: Monospaced; font-style: italic}
|
||||
.literal {color: #0000e6}
|
||||
.string {color: #ce7b00}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table width="100%"><tr><td align="center">C:\Users\ar114\Documents\NetBeansProjects\ProgrammingExam1_CalebFontenot\src\programmingexam1_calebfontenot\TwoLargerOfThe3.java</td></tr></table>
|
||||
<pre>
|
||||
<span class="comment">/*</span>
|
||||
<span class="comment"> * To change this license header, choose License Headers in Project Properties.</span>
|
||||
<span class="comment"> * To change this template file, choose Tools | Templates</span>
|
||||
<span class="comment"> * and open the template in the editor.</span>
|
||||
<span class="comment"> */</span>
|
||||
<span class="literal">package</span> programmingexam1_calebfontenot;
|
||||
|
||||
<span class="literal">import</span> java.util.Scanner;
|
||||
|
||||
<span class="comment">/**</span>
|
||||
<span class="comment"> *</span>
|
||||
<span class="comment"> * </span><span class="ST0">@author</span> <span class="comment">ar114</span>
|
||||
<span class="comment">*/</span>
|
||||
<span class="literal">public</span> <span class="literal">class</span> <span class="ST1">TwoLargerOfThe3</span> {
|
||||
|
||||
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST2">main</span>(String[] args) {
|
||||
<span class="comment">// Define vars</span>
|
||||
<span class="literal">int</span> _1, _2, _3; <span class="comment">// Note to Markou: I find numbers easier to compare in my head than variables, hence my use of them here.</span>
|
||||
<span class="literal">int</span> firstLargest = 0, secondLargest = 0;
|
||||
|
||||
<span class="comment">// Setup scanner</span>
|
||||
Scanner input = <span class="literal">new</span> Scanner(System.<span class="ST3">in</span>);
|
||||
<span class="literal">while</span> (<span class="literal">true</span>) {
|
||||
<span class="comment">// Prompt for input</span>
|
||||
System.<span class="ST3">out</span>.print(<span class="string">"</span><span class="string">Enter 3 numbers: </span><span class="string">"</span>);
|
||||
_1 = input.nextInt();
|
||||
_2 = input.nextInt();
|
||||
_3 = input.nextInt();
|
||||
|
||||
<span class="comment">// Compute!</span>
|
||||
<span class="literal">if</span> (_1 <= _3 & _2 <= _3) { <span class="comment">// Is _3 the largest?</span>
|
||||
firstLargest = _3; <span class="comment">// Yes!</span>
|
||||
<span class="literal">if</span> (_2 >= _1) { <span class="comment">// Is _2 larger than _1?</span>
|
||||
secondLargest = _2; <span class="comment">//Then _2 must be the second largest.</span>
|
||||
} <span class="literal">else</span> {
|
||||
secondLargest = _1; <span class="comment">//Then _1 must be the second largest.</span>
|
||||
}
|
||||
}
|
||||
<span class="literal">if</span> (_3 <= _2 & _1 <= _2) { <span class="comment">// Is _2 the largest?</span>
|
||||
firstLargest = _2; <span class="comment">// Yes!</span>
|
||||
<span class="literal">if</span> (_3 >= _1) { <span class="comment">//Is _3 larger than _1?</span>
|
||||
secondLargest = _3; <span class="comment">// Then _3 must be the largest.</span>
|
||||
} <span class="literal">else</span> {
|
||||
secondLargest = _1; <span class="comment">// Then _1 must be the largest.</span>
|
||||
}
|
||||
}
|
||||
<span class="literal">if</span> (_3 <= _1 & _2 <= _1) { <span class="comment">// Is _1 the largest?</span>
|
||||
firstLargest = _1; <span class="comment">// Yes!</span>
|
||||
<span class="literal">if</span> (_3 >= _2) {<span class="comment">// Is _3 larger than _2?</span>
|
||||
secondLargest = _3; <span class="comment">// Then _3 must be the largest.</span>
|
||||
} <span class="literal">else</span> {
|
||||
secondLargest = _2; <span class="comment">// Then _2 must be the largest.</span>
|
||||
}
|
||||
}
|
||||
<span class="literal">if</span> (_1 == _2 | _1 == _3 | _2 == _3) {
|
||||
System.<span class="ST3">out</span>.println(<span class="string">"</span><span class="string">Some numbers equal. Running additional checks...</span><span class="string">"</span>);
|
||||
<span class="literal">if</span> (_1 == _2) {
|
||||
<span class="literal">if</span> (_1 > _3) { <span class="comment">// Is _3 smaller than _1 and _2?</span>
|
||||
firstLargest = _1;
|
||||
secondLargest = _3;
|
||||
}
|
||||
}
|
||||
<span class="literal">if</span> (_1 == _3) {
|
||||
<span class="literal">if</span> (_3 > _2) { <span class="comment">// Is _2 smaller than _1 and _3? </span>
|
||||
firstLargest = _3;
|
||||
secondLargest = _2;
|
||||
}
|
||||
}
|
||||
<span class="literal">if</span> (_2 == _3) {
|
||||
<span class="literal">if</span> (_3 > _1) { <span class="comment">// Is _1 smaller than _2 or _3?</span>
|
||||
firstLargest = _3;
|
||||
secondLargest = _1;
|
||||
}
|
||||
}
|
||||
}
|
||||
<span class="comment">// Output</span>
|
||||
System.<span class="ST3">out</span>.println(<span class="string">"</span><span class="string">The first largest is </span><span class="string">"</span> + firstLargest + <span class="string">"</span><span class="string"> and the second largest is </span><span class="string">"</span> + secondLargest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</pre></body>
|
||||
</html>
|
73
Exams/ProgrammingExam1_CalebFontenot/build.xml
Executable file
73
Exams/ProgrammingExam1_CalebFontenot/build.xml
Executable file
@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- You may freely edit this file. See commented blocks below for -->
|
||||
<!-- some examples of how to customize the build. -->
|
||||
<!-- (If you delete it and reopen the project it will be recreated.) -->
|
||||
<!-- By default, only the Clean and Build commands use this build script. -->
|
||||
<!-- Commands such as Run, Debug, and Test only use this build script if -->
|
||||
<!-- the Compile on Save feature is turned off for the project. -->
|
||||
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
|
||||
<!-- in the project's Project Properties dialog box.-->
|
||||
<project name="ProgrammingExam1_CalebFontenot" default="default" basedir=".">
|
||||
<description>Builds, tests, and runs the project ProgrammingExam1_CalebFontenot.</description>
|
||||
<import file="nbproject/build-impl.xml"/>
|
||||
<!--
|
||||
|
||||
There exist several targets which are by default empty and which can be
|
||||
used for execution of your tasks. These targets are usually executed
|
||||
before and after some main targets. They are:
|
||||
|
||||
-pre-init: called before initialization of project properties
|
||||
-post-init: called after initialization of project properties
|
||||
-pre-compile: called before javac compilation
|
||||
-post-compile: called after javac compilation
|
||||
-pre-compile-single: called before javac compilation of single file
|
||||
-post-compile-single: called after javac compilation of single file
|
||||
-pre-compile-test: called before javac compilation of JUnit tests
|
||||
-post-compile-test: called after javac compilation of JUnit tests
|
||||
-pre-compile-test-single: called before javac compilation of single JUnit test
|
||||
-post-compile-test-single: called after javac compilation of single JUunit test
|
||||
-pre-jar: called before JAR building
|
||||
-post-jar: called after JAR building
|
||||
-post-clean: called after cleaning build products
|
||||
|
||||
(Targets beginning with '-' are not intended to be called on their own.)
|
||||
|
||||
Example of inserting an obfuscator after compilation could look like this:
|
||||
|
||||
<target name="-post-compile">
|
||||
<obfuscate>
|
||||
<fileset dir="${build.classes.dir}"/>
|
||||
</obfuscate>
|
||||
</target>
|
||||
|
||||
For list of available properties check the imported
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
|
||||
Another way to customize the build is by overriding existing main targets.
|
||||
The targets of interest are:
|
||||
|
||||
-init-macrodef-javac: defines macro for javac compilation
|
||||
-init-macrodef-junit: defines macro for junit execution
|
||||
-init-macrodef-debug: defines macro for class debugging
|
||||
-init-macrodef-java: defines macro for class execution
|
||||
-do-jar: JAR building
|
||||
run: execution of project
|
||||
-javadoc-build: Javadoc generation
|
||||
test-report: JUnit report generation
|
||||
|
||||
An example of overriding the target for project execution could look like this:
|
||||
|
||||
<target name="run" depends="ProgrammingExam1_CalebFontenot-impl.jar">
|
||||
<exec dir="bin" executable="launcher.exe">
|
||||
<arg file="${dist.jar}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
Notice that the overridden target depends on the jar target and not only on
|
||||
the compile target as the regular run target does. Again, for a list of available
|
||||
properties which you can use, check the target you are overriding in the
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
-->
|
||||
</project>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3
Exams/ProgrammingExam1_CalebFontenot/manifest.mf
Executable file
3
Exams/ProgrammingExam1_CalebFontenot/manifest.mf
Executable file
@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
X-COMMENT: Main-Class will be added automatically by build
|
||||
|
1420
Exams/ProgrammingExam1_CalebFontenot/nbproject/build-impl.xml
Executable file
1420
Exams/ProgrammingExam1_CalebFontenot/nbproject/build-impl.xml
Executable file
File diff suppressed because it is too large
Load Diff
8
Exams/ProgrammingExam1_CalebFontenot/nbproject/genfiles.properties
Executable file
8
Exams/ProgrammingExam1_CalebFontenot/nbproject/genfiles.properties
Executable file
@ -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
|
@ -0,0 +1,2 @@
|
||||
compile.on.save=true
|
||||
user.properties.file=C:\\Users\\ar114\\AppData\\Roaming\\NetBeans\\8.2\\build.properties
|
13
Exams/ProgrammingExam1_CalebFontenot/nbproject/private/private.xml
Executable file
13
Exams/ProgrammingExam1_CalebFontenot/nbproject/private/private.xml
Executable file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
||||
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
|
||||
<group>
|
||||
<file>file:/C:/Users/ar114/Documents/NetBeansProjects/ProgrammingExam1_CalebFontenot/src/programmingexam1_calebfontenot/TwoLargerOfThe3.java</file>
|
||||
<file>file:/C:/Users/ar114/Documents/NetBeansProjects/ProgrammingExam1_CalebFontenot/src/programmingexam1_calebfontenot/ProgrammingExam1_CalebFontenot.java</file>
|
||||
<file>file:/C:/Users/ar114/Documents/NetBeansProjects/ProgrammingExam1_CalebFontenot/src/programmingexam1_calebfontenot/QuotientAndRemainderOfNumbersInAnyOrder.java</file>
|
||||
<file>file:/C:/Users/ar114/Documents/NetBeansProjects/ProgrammingExam1_CalebFontenot/src/programmingexam1_calebfontenot/LeapYear.java</file>
|
||||
<file>file:/C:/Users/ar114/Documents/NetBeansProjects/ProgrammingExam1_CalebFontenot/src/programmingexam1_calebfontenot/QuotientAndRemainder.java</file>
|
||||
</group>
|
||||
</open-files>
|
||||
</project-private>
|
74
Exams/ProgrammingExam1_CalebFontenot/nbproject/project.properties
Executable file
74
Exams/ProgrammingExam1_CalebFontenot/nbproject/project.properties
Executable file
@ -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
|
15
Exams/ProgrammingExam1_CalebFontenot/nbproject/project.xml
Executable file
15
Exams/ProgrammingExam1_CalebFontenot/nbproject/project.xml
Executable file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||
<type>org.netbeans.modules.java.j2seproject</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<name>ProgrammingExam1_CalebFontenot</name>
|
||||
<source-roots>
|
||||
<root id="src.dir"/>
|
||||
</source-roots>
|
||||
<test-roots>
|
||||
<root id="test.src.dir"/>
|
||||
</test-roots>
|
||||
</data>
|
||||
</configuration>
|
||||
</project>
|
@ -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);
|
||||
}
|
||||
}
|
@ -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
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
BIN
ZIPs/ProgrammingExam1_CalebFontenot.zip
Executable file
BIN
ZIPs/ProgrammingExam1_CalebFontenot.zip
Executable file
Binary file not shown.
Loading…
Reference in New Issue
Block a user