new semester, new repo structure

This commit is contained in:
2023-01-10 11:59:05 -06:00
parent 0a76658f85
commit ba6de6e18e
725 changed files with 1199 additions and 103 deletions

View File

@@ -0,0 +1,48 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>ForNested1.java</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
<!--
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
table {color: #888888; background-color: #313335; font-family: monospace; font-weight: bold}
.number {color: #6897bb}
.string {color: #6a8759}
.comment {color: #808080}
.whitespace {color: #505050}
.literal {color: #cc7832}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Assignments/lab12_CalebFontenot/src/lab12_calebfontenot/ForNested1.java</td></tr></table>
<pre>
<span class="comment">/*</span>
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license</span>
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template</span>
<span class="comment"> */</span>
<span class="literal">package</span> lab12_calebfontenot;
<span class="comment">/**</span>
<span class="comment"> *</span>
<span class="comment"> * </span><span class="comment">@author</span> <span class="comment">caleb</span>
<span class="comment">*/</span>
<span class="literal">public</span> <span class="literal">class</span> ForNested1 {
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> main(String[] args)
{
<span class="literal">for</span> (<span class="literal">int</span> i = <span class="number">0</span>; i &lt; <span class="number">3</span>; ++i)
{
System.out.print(<span class="string">&quot;</span><span class="string">(i, j) = </span><span class="string">&quot;</span>);
<span class="literal">for</span> (<span class="literal">int</span> j = <span class="number">0</span>; j &lt; <span class="number">4</span>; ++j)
{
System.out.print(<span class="string">&quot;</span><span class="string">(</span><span class="string">&quot;</span> + i + <span class="string">&quot;</span><span class="string">, </span><span class="string">&quot;</span> + j + <span class="string">&quot;</span><span class="string">) </span><span class="string">&quot;</span>);
}
System.out.println(<span class="string">&quot;&quot;</span>);
}
}
}
</pre></body>
</html>

View File

@@ -0,0 +1,43 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Lab12_CalebFontenot.java</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
<!--
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
table {color: #888888; background-color: #313335; font-family: monospace; font-weight: bold}
.comment {color: #808080}
.whitespace {color: #505050}
.literal {color: #cc7832}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Assignments/lab12_CalebFontenot/src/lab12_calebfontenot/Lab12_CalebFontenot.java</td></tr></table>
<pre>
<span class="comment">/*</span>
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license</span>
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template</span>
<span class="comment"> */</span>
<span class="literal">package</span> lab12_calebfontenot;
<span class="comment">/**</span>
<span class="comment"> *</span>
<span class="comment"> * </span><span class="comment">@author</span> <span class="comment">caleb</span>
<span class="comment">*/</span>
<span class="literal">public</span> <span class="literal">class</span> Lab12_CalebFontenot {
<span class="comment">/**</span>
<span class="comment"> * </span><span class="comment">@param</span> <span class="comment">args</span> <span class="comment">the</span> <span class="comment">command</span> <span class="comment">line</span> <span class="comment">arguments</span>
<span class="comment">*/</span>
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> main(String[] args)
{
<span class="comment">// TODO code application logic here</span>
}
}
</pre></body>
</html>

View File

@@ -0,0 +1,54 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>NestedForPatternA.java</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
<!--
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
table {color: #888888; background-color: #313335; font-family: monospace; font-weight: bold}
.number {color: #6897bb}
.string {color: #6a8759}
.comment {color: #808080}
.whitespace {color: #505050}
.literal {color: #cc7832}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Assignments/lab12_CalebFontenot/src/lab12_calebfontenot/NestedForPatternA.java</td></tr></table>
<pre>
<span class="comment">/*</span>
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license</span>
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template</span>
<span class="comment"> */</span>
<span class="literal">package</span> lab12_calebfontenot;
<span class="comment">/**</span>
<span class="comment"> *</span>
<span class="comment"> * </span><span class="comment">@author</span> <span class="comment">caleb</span>
<span class="comment">*/</span>
<span class="literal">public</span> <span class="literal">class</span> NestedForPatternA {
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> main(String[] args)
{
<span class="comment">/*</span>
<span class="comment"> String line = &quot;&quot;;</span>
<span class="comment"> //First for loop</span>
<span class="comment"> for (int i = 1; i &lt;= 6; ++i)</span>
<span class="comment"> {</span>
<span class="comment"> line = line + &quot; &quot; + i;</span>
<span class="comment"> System.out.println(line);</span>
<span class="comment"> }</span>
<span class="comment"> */</span>
<span class="literal">for</span> (<span class="literal">int</span> i = <span class="number">1</span>; i &lt; <span class="number">7</span>; i++) {
<span class="literal">for</span> (<span class="literal">int</span> j = <span class="number">1</span>; j &lt; i + <span class="number">1</span>; j++) {
System.out.print(j + <span class="string">&quot;</span> <span class="string">&quot;</span>);
}
System.out.println();
}
}
}
</pre></body>
</html>

View File

@@ -0,0 +1,54 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>NestedForPatternB.java</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
<!--
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
table {color: #888888; background-color: #313335; font-family: monospace; font-weight: bold}
.number {color: #6897bb}
.string {color: #6a8759}
.comment {color: #808080}
.whitespace {color: #505050}
.literal {color: #cc7832}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Assignments/lab12_CalebFontenot/src/lab12_calebfontenot/NestedForPatternB.java</td></tr></table>
<pre>
<span class="comment">/*</span>
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license</span>
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template</span>
<span class="comment"> */</span>
<span class="literal">package</span> lab12_calebfontenot;
<span class="comment">/**</span>
<span class="comment"> *</span>
<span class="comment"> * </span><span class="comment">@author</span> <span class="comment">caleb</span>
<span class="comment">*/</span>
<span class="literal">public</span> <span class="literal">class</span> NestedForPatternB {
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> main(String[] args)
{
<span class="comment">/*</span>
<span class="comment"> String line = &quot;&quot;;</span>
<span class="comment"> //First for loop</span>
<span class="comment"> for (int i = 1; i &lt;= 6; ++i)</span>
<span class="comment"> {</span>
<span class="comment"> line = line + &quot; &quot; + i;</span>
<span class="comment"> System.out.println(line);</span>
<span class="comment"> }</span>
<span class="comment"> */</span>
<span class="literal">for</span> (<span class="literal">int</span> i = <span class="number">6</span>; i &gt; <span class="number">0</span>; i--) {
<span class="literal">for</span> (<span class="literal">int</span> j = <span class="number">1</span>; j &lt; i + <span class="number">1</span>; j++) {
System.out.print(j + <span class="string">&quot;</span> <span class="string">&quot;</span>);
}
System.out.println();
}
}
}
</pre></body>
</html>

View File

@@ -0,0 +1,64 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>NestedForPyramid.java</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
<!--
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
table {color: #888888; background-color: #313335; font-family: monospace; font-weight: bold}
.number {color: #6897bb}
.string {color: #6a8759}
.comment {color: #808080}
.whitespace {color: #505050}
.ST1 {color: #ffc66d; font-family: monospace; font-weight: bold; font-style: italic}
.ST2 {color: #9876aa; font-family: monospace; font-weight: bold; font-style: italic}
.ST0 {color: #287bde}
.literal {color: #cc7832}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Assignments/lab12_CalebFontenot/src/lab12_calebfontenot/NestedForPyramid.java</td></tr></table>
<pre>
<span class="comment">/*</span>
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt</span><span class="comment"> to change this license</span>
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java</span><span class="comment"> to edit this template</span>
<span class="comment"> */</span>
<span class="literal">package</span> lab12_calebfontenot;
<span class="comment">/**</span>
<span class="comment"> *</span>
<span class="comment"> * </span><span class="comment">@author</span> <span class="comment">caleb</span>
<span class="comment">*/</span>
<span class="literal">public</span> <span class="literal">class</span> NestedForPyramid {
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST1">main</span>(String[] args) {
<span class="literal">int</span> startRight = <span class="number">0</span>, <span class="comment">//Init decending numbers</span>
endSpace = <span class="number">7</span>; <span class="comment">//Init number of whitespaces to pad</span>
<span class="comment">// PRIMARY FOR LOOP</span>
<span class="literal">for</span> (<span class="literal">int</span> row = <span class="number">1</span>; row &lt;= <span class="number">128</span>; row += row) {
<span class="comment">// Whitespace Moment</span>
<span class="literal">for</span> (<span class="literal">int</span> startSpace = <span class="number">0</span>; startSpace &lt; endSpace; startSpace++) {
System.<span class="ST2">out</span>.print(<span class="string">&quot;</span> <span class="string">&quot;</span>);
}
<span class="comment">// Display ascending numbers</span>
<span class="literal">for</span> (<span class="literal">int</span> l = <span class="number">1</span>; l &lt;= row; l += l) {
System.<span class="ST2">out</span>.printf(<span class="string">&quot;</span><span class="string">%4d</span><span class="string">&quot;</span>, (l));
}
<span class="comment">// Display decending numbers</span>
<span class="literal">for</span> (<span class="literal">int</span> r = startRight; r &gt; <span class="number">0</span>; r /= <span class="number">2</span>) {
System.<span class="ST2">out</span>.printf(<span class="string">&quot;</span><span class="string">%4d</span><span class="string">&quot;</span>, (r));
}
System.<span class="ST2">out</span>.println();
endSpace--;
startRight = row;
}
}
}
</pre></body>
</html>

View File

@@ -0,0 +1,64 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>NestedWhilePatternC.java</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
<!--
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
table {color: #888888; background-color: #313335; font-family: monospace; font-weight: bold}
.number {color: #6897bb}
.string {color: #6a8759}
.comment {color: #808080}
.whitespace {color: #505050}
.ST1 {color: #ffc66d; font-family: monospace; font-weight: bold; font-style: italic}
.ST2 {color: #9876aa; font-family: monospace; font-weight: bold; font-style: italic}
.ST0 {color: #287bde}
.literal {color: #cc7832}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Assignments/lab12_CalebFontenot/src/lab12_calebfontenot/NestedWhilePatternC.java</td></tr></table>
<pre>
<span class="comment">/*</span>
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt</span><span class="comment"> to change this license</span>
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java</span><span class="comment"> to edit this template</span>
<span class="comment"> */</span>
<span class="literal">package</span> lab12_calebfontenot;
<span class="comment">/**</span>
<span class="comment"> *</span>
<span class="comment"> * </span><span class="comment">@author</span> <span class="comment">caleb</span>
<span class="comment">*/</span>
<span class="literal">public</span> <span class="literal">class</span> NestedWhilePatternC {
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST1">main</span>(String[] args) {
<span class="comment">// Define variables</span>
<span class="literal">int</span> numberOfLines = <span class="number">6</span>;
<span class="literal">int</span> rows = <span class="number">1</span>;
<span class="literal">int</span> spacing;
<span class="literal">int</span> collums;
<span class="comment">//Main while looping</span>
<span class="literal">while</span> (rows &lt;= numberOfLines) {
spacing = numberOfLines - rows;
<span class="literal">while</span> (spacing &gt;= <span class="number">1</span>) { <span class="comment">//Spacing</span>
System.<span class="ST2">out</span>.print(<span class="string">&quot;</span> <span class="string">&quot;</span>);
spacing--;
}
collums = rows;
<span class="literal">while</span> (collums &gt;= <span class="number">1</span>) { <span class="comment">//Number printing</span>
System.<span class="ST2">out</span>.print(collums + <span class="string">&quot;</span> <span class="string">&quot;</span>);
collums--;
}
System.<span class="ST2">out</span>.println();
rows++;
}
}
}
</pre></body>
</html>

View File

@@ -0,0 +1,64 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>NestedWhilePatternD.java</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
<!--
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
table {color: #888888; background-color: #313335; font-family: monospace; font-weight: bold}
.number {color: #6897bb}
.string {color: #6a8759}
.comment {color: #808080}
.whitespace {color: #505050}
.ST1 {color: #ffc66d; font-family: monospace; font-weight: bold; font-style: italic}
.ST2 {color: #9876aa; font-family: monospace; font-weight: bold; font-style: italic}
.ST0 {color: #287bde}
.literal {color: #cc7832}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Assignments/lab12_CalebFontenot/src/lab12_calebfontenot/NestedWhilePatternD.java</td></tr></table>
<pre>
<span class="comment">/*</span>
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt</span><span class="comment"> to change this license</span>
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java</span><span class="comment"> to edit this template</span>
<span class="comment"> */</span>
<span class="literal">package</span> lab12_calebfontenot;
<span class="comment">/**</span>
<span class="comment"> *</span>
<span class="comment"> * </span><span class="comment">@author</span> <span class="comment">caleb</span>
<span class="comment">*/</span>
<span class="literal">public</span> <span class="literal">class</span> NestedWhilePatternD {
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST1">main</span>(String[] args) {
<span class="comment">// Define variables</span>
<span class="literal">int</span> numberOfLines = <span class="number">6</span>;
<span class="literal">int</span> rows = <span class="number">1</span>;
<span class="literal">int</span> spacing;
<span class="literal">int</span> collums;
<span class="comment">//Main while looping</span>
<span class="literal">while</span> (rows &lt;= numberOfLines) {
spacing = numberOfLines - rows;
<span class="literal">while</span> (spacing &lt; <span class="number">6</span>) { <span class="comment">//Spacing</span>
System.<span class="ST2">out</span>.print(<span class="string">&quot;</span> <span class="string">&quot;</span>);
spacing++;
}
collums = rows;
<span class="literal">while</span> (collums &lt;= <span class="number">6</span>) { <span class="comment">// Number printing</span>
System.<span class="ST2">out</span>.print((collums - rows + <span class="number">1</span>) + <span class="string">&quot;</span> <span class="string">&quot;</span>);
collums++;
}
System.<span class="ST2">out</span>.println();
rows++;
}
}
}
</pre></body>
</html>

View File

@@ -0,0 +1,73 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Palindrome1.java</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
<!--
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
table {color: #888888; background-color: #313335; font-family: monospace; font-weight: bold}
.string {color: #6a8759}
.number {color: #6897bb}
.comment {color: #808080}
.whitespace {color: #505050}
.ST1 {color: #ffc66d; font-family: monospace; font-weight: bold; font-style: italic}
.ST2 {color: #9876aa; font-family: monospace; font-weight: bold; font-style: italic}
.ST0 {color: #287bde}
.literal {color: #cc7832}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Assignments/lab12_CalebFontenot/src/lab12_calebfontenot/Palindrome1.java</td></tr></table>
<pre>
<span class="comment">/*</span>
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt</span><span class="comment"> to change this license</span>
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java</span><span class="comment"> to edit this template</span>
<span class="comment"> */</span>
<span class="literal">package</span> lab12_calebfontenot;
<span class="literal">import</span> java.util.Scanner;
<span class="comment">/**</span>
<span class="comment"> *</span>
<span class="comment"> * </span><span class="comment">@author</span> <span class="comment">caleb</span>
<span class="comment">*/</span>
<span class="literal">public</span> <span class="literal">class</span> Palindrome1 {
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST1">main</span>(String[] args) {
<span class="comment">// Create a Scanner</span>
Scanner input = <span class="literal">new</span> Scanner(System.<span class="ST2">in</span>);
<span class="comment">// Prompt the user to enter a string</span>
System.<span class="ST2">out</span>.print(<span class="string">&quot;</span><span class="string">Enter a string: </span><span class="string">&quot;</span>);
String s = input.nextLine();
<span class="comment">// The index of the first character in the string</span>
<span class="literal">int</span> low = <span class="number">0</span>;
<span class="comment">// The index of the last character in the string</span>
<span class="literal">int</span> high = s.length() - <span class="number">1</span>;
<span class="literal">boolean</span> isPalindrome = <span class="literal">true</span>;
<span class="literal">while</span> (low &lt; high) {
<span class="literal">if</span> (s.charAt(low) != s.charAt(high)) {
isPalindrome = <span class="literal">false</span>;
<span class="literal">break</span>;
}
low++;
high--;
}
<span class="literal">if</span> (isPalindrome) {
System.<span class="ST2">out</span>.println(s + <span class="string">&quot;</span><span class="string"> is a palindrome</span><span class="string">&quot;</span>);
} <span class="literal">else</span> {
System.<span class="ST2">out</span>.println(s + <span class="string">&quot;</span><span class="string"> is not a palindrome</span><span class="string">&quot;</span>);
}
}
}
</pre></body>
</html>

View File

@@ -0,0 +1,73 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Palindrome2.java</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
<!--
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
table {color: #888888; background-color: #313335; font-family: monospace; font-weight: bold}
.string {color: #6a8759}
.number {color: #6897bb}
.comment {color: #808080}
.whitespace {color: #505050}
.ST1 {color: #ffc66d; font-family: monospace; font-weight: bold; font-style: italic}
.ST2 {color: #9876aa; font-family: monospace; font-weight: bold; font-style: italic}
.ST0 {color: #287bde}
.literal {color: #cc7832}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Assignments/lab12_CalebFontenot/src/lab12_calebfontenot/Palindrome2.java</td></tr></table>
<pre>
<span class="comment">/*</span>
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt</span><span class="comment"> to change this license</span>
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java</span><span class="comment"> to edit this template</span>
<span class="comment"> */</span>
<span class="literal">package</span> lab12_calebfontenot;
<span class="literal">import</span> java.util.Scanner;
<span class="comment">/**</span>
<span class="comment"> *</span>
<span class="comment"> * </span><span class="comment">@author</span> <span class="comment">caleb</span>
<span class="comment">*/</span>
<span class="literal">public</span> <span class="literal">class</span> Palindrome2 {
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST1">main</span>(String[] args) {
<span class="comment">// Create a Scanner</span>
Scanner input = <span class="literal">new</span> Scanner(System.<span class="ST2">in</span>);
<span class="comment">// Prompt the user to enter a string</span>
System.<span class="ST2">out</span>.print(<span class="string">&quot;</span><span class="string">Enter a string: </span><span class="string">&quot;</span>);
String s = input.nextLine();
<span class="comment">// The index of the first character in the string</span>
<span class="literal">int</span> low;
<span class="comment">// The index of the last character in the string</span>
<span class="literal">int</span> high = s.length() - <span class="number">1</span>;
<span class="literal">boolean</span> isPalindrome = <span class="literal">true</span>;
<span class="literal">for</span> (low = <span class="number">0</span>; low &lt; high; low++) {
<span class="literal">if</span> (s.charAt(low) != s.charAt(high)) {
isPalindrome = <span class="literal">false</span>;
<span class="literal">break</span>;
}
<span class="comment">//low++;</span>
high--;
}
<span class="literal">if</span> (isPalindrome) {
System.<span class="ST2">out</span>.println(s + <span class="string">&quot;</span><span class="string"> is a palindrome</span><span class="string">&quot;</span>);
} <span class="literal">else</span> {
System.<span class="ST2">out</span>.println(s + <span class="string">&quot;</span><span class="string"> is not a palindrome</span><span class="string">&quot;</span>);
}
}
}
</pre></body>
</html>

View File

@@ -0,0 +1,55 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>TestBreak1.java</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
<!--
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
table {color: #888888; background-color: #313335; font-family: monospace; font-weight: bold}
.number {color: #6897bb}
.string {color: #6a8759}
.comment {color: #808080}
.whitespace {color: #505050}
.ST1 {color: #ffc66d; font-family: monospace; font-weight: bold; font-style: italic}
.ST2 {color: #9876aa; font-family: monospace; font-weight: bold; font-style: italic}
.ST0 {color: #287bde}
.literal {color: #cc7832}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Assignments/lab12_CalebFontenot/src/lab12_calebfontenot/TestBreak1.java</td></tr></table>
<pre>
<span class="comment">/*</span>
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt</span><span class="comment"> to change this license</span>
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java</span><span class="comment"> to edit this template</span>
<span class="comment"> */</span>
<span class="literal">package</span> lab12_calebfontenot;
<span class="comment">/**</span>
<span class="comment"> *</span>
<span class="comment"> * </span><span class="comment">@author</span> <span class="comment">caleb</span>
<span class="comment">*/</span>
<span class="literal">public</span> <span class="literal">class</span> TestBreak1 {
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST1">main</span>(String[] args) {
<span class="literal">int</span> sum = <span class="number">0</span>,
number = <span class="number">0</span>;
<span class="literal">while</span> (number &lt; <span class="number">20</span>) {
<span class="literal">if</span> (sum &gt;= <span class="number">100</span>) {
<span class="literal">break</span>;
}
number++;
sum += number;
System.<span class="ST2">out</span>.println(<span class="string">&quot;</span><span class="string">Current sum: </span><span class="string">&quot;</span> + sum);
}
System.<span class="ST2">out</span>.println(<span class="string">&quot;</span><span class="literal">\n</span><span class="string">The number is </span><span class="string">&quot;</span> + number);
System.<span class="ST2">out</span>.println(<span class="string">&quot;</span><span class="string">The sum is </span><span class="string">&quot;</span> + sum);
}
}
</pre></body>
</html>

View File

@@ -0,0 +1,55 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>TestBreak2.java</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
<!--
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
table {color: #888888; background-color: #313335; font-family: monospace; font-weight: bold}
.number {color: #6897bb}
.string {color: #6a8759}
.comment {color: #808080}
.whitespace {color: #505050}
.ST1 {color: #ffc66d; font-family: monospace; font-weight: bold; font-style: italic}
.ST2 {color: #9876aa; font-family: monospace; font-weight: bold; font-style: italic}
.ST0 {color: #287bde}
.literal {color: #cc7832}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Assignments/lab12_CalebFontenot/src/lab12_calebfontenot/TestBreak2.java</td></tr></table>
<pre>
<span class="comment">/*</span>
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt</span><span class="comment"> to change this license</span>
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java</span><span class="comment"> to edit this template</span>
<span class="comment"> */</span>
<span class="literal">package</span> lab12_calebfontenot;
<span class="comment">/**</span>
<span class="comment"> *</span>
<span class="comment"> * </span><span class="comment">@author</span> <span class="comment">caleb</span>
<span class="comment">*/</span>
<span class="literal">public</span> <span class="literal">class</span> TestBreak2 {
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST1">main</span>(String[] args) {
<span class="literal">int</span> sum = <span class="number">0</span>,
number; <span class="comment">// Define number here intead of inside the for loop so that &#39;number&#39; doesn&#39;t get removed from memory the second the for loop is broken out of.</span>
<span class="literal">for</span> (number = <span class="number">0</span>; number &lt; <span class="number">20</span>; number++) {
<span class="literal">if</span> (sum &gt;= <span class="number">100</span>) {
<span class="literal">break</span>;
}
sum += number;
System.<span class="ST2">out</span>.println(<span class="string">&quot;</span><span class="string">Current sum: </span><span class="string">&quot;</span> + sum);
}
System.<span class="ST2">out</span>.println(<span class="string">&quot;</span><span class="literal">\n</span><span class="string">The number is </span><span class="string">&quot;</span> + number);
System.<span class="ST2">out</span>.println(<span class="string">&quot;</span><span class="string">The sum is </span><span class="string">&quot;</span> + sum);
}
}
</pre></body>
</html>

View 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>TestContinue1.java</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
<!--
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
table {color: #888888; background-color: #313335; font-family: monospace; font-weight: bold}
.number {color: #6897bb}
.string {color: #6a8759}
.comment {color: #808080}
.whitespace {color: #505050}
.ST1 {color: #ffc66d; font-family: monospace; font-weight: bold; font-style: italic}
.ST2 {color: #9876aa; font-family: monospace; font-weight: bold; font-style: italic}
.ST0 {color: #287bde}
.literal {color: #cc7832}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Assignments/lab12_CalebFontenot/src/lab12_calebfontenot/TestContinue1.java</td></tr></table>
<pre>
<span class="comment">/*</span>
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt</span><span class="comment"> to change this license</span>
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java</span><span class="comment"> to edit this template</span>
<span class="comment"> */</span>
<span class="literal">package</span> lab12_calebfontenot;
<span class="comment">/**</span>
<span class="comment"> *</span>
<span class="comment"> * </span><span class="comment">@author</span> <span class="comment">caleb</span>
<span class="comment">*/</span>
<span class="literal">public</span> <span class="literal">class</span> TestContinue1 {
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST1">main</span>(String[] args) {
<span class="literal">int</span> sum = <span class="number">0</span>,
number = <span class="number">0</span>;
<span class="literal">while</span> (number &lt; <span class="number">20</span>) {
number++;
sum += number;
<span class="literal">if</span> (number == <span class="number">10</span> || number == <span class="number">11</span>) {
<span class="literal">continue</span>;
}
}
System.<span class="ST2">out</span>.println(number);
System.<span class="ST2">out</span>.println(<span class="string">&quot;</span><span class="string">The sum is </span><span class="string">&quot;</span> + sum);
}
}
</pre></body>
</html>

View File

@@ -0,0 +1,52 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>TestContinue2.java</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
<!--
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
table {color: #888888; background-color: #313335; font-family: monospace; font-weight: bold}
.number {color: #6897bb}
.string {color: #6a8759}
.comment {color: #808080}
.whitespace {color: #505050}
.ST1 {color: #ffc66d; font-family: monospace; font-weight: bold; font-style: italic}
.ST2 {color: #9876aa; font-family: monospace; font-weight: bold; font-style: italic}
.ST0 {color: #287bde}
.literal {color: #cc7832}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Assignments/lab12_CalebFontenot/src/lab12_calebfontenot/TestContinue2.java</td></tr></table>
<pre>
<span class="comment">/*</span>
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt</span><span class="comment"> to change this license</span>
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java</span><span class="comment"> to edit this template</span>
<span class="comment"> */</span>
<span class="literal">package</span> lab12_calebfontenot;
<span class="comment">/**</span>
<span class="comment"> *</span>
<span class="comment"> * </span><span class="comment">@author</span> <span class="comment">caleb</span>
<span class="comment">*/</span>
<span class="literal">public</span> <span class="literal">class</span> TestContinue2 {
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST1">main</span>(String[] args) {
<span class="literal">int</span> sum = <span class="number">0</span>,
number;
<span class="literal">for</span> (number = <span class="number">0</span>; number &lt; <span class="number">20</span>; number++) {
sum += number;
<span class="literal">if</span> (number == <span class="number">10</span> || number == <span class="number">11</span>) {
<span class="literal">continue</span>;
}
}
System.<span class="ST2">out</span>.println(number);
System.<span class="ST2">out</span>.println(<span class="string">&quot;</span><span class="string">The sum is </span><span class="string">&quot;</span> + sum);
}
}
</pre></body>
</html>

View File

@@ -0,0 +1,48 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>WhileNested2.java</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
<!--
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
table {color: #888888; background-color: #313335; font-family: monospace; font-weight: bold}
.number {color: #6897bb}
.string {color: #6a8759}
.comment {color: #808080}
.whitespace {color: #505050}
.literal {color: #cc7832}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Assignments/lab12_CalebFontenot/src/lab12_calebfontenot/WhileNested2.java</td></tr></table>
<pre>
<span class="comment">/*</span>
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license</span>
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template</span>
<span class="comment"> */</span>
<span class="literal">package</span> lab12_calebfontenot;
<span class="comment">/**</span>
<span class="comment"> *</span>
<span class="comment"> * </span><span class="comment">@author</span> <span class="comment">caleb</span>
<span class="comment">*/</span>
<span class="literal">public</span> <span class="literal">class</span> WhileNested2 {
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> main(String[] args)
{
<span class="literal">int</span> i = <span class="number">0</span>;
<span class="literal">while</span> (i &lt; <span class="number">3</span>)
{
System.out.print(<span class="string">&quot;</span><span class="string">(i, j) = </span><span class="string">&quot;</span>);
<span class="literal">for</span> (<span class="literal">int</span> j = <span class="number">0</span>; j &lt; <span class="number">4</span>; ++j)
System.out.print(<span class="string">&quot;</span><span class="string">(</span><span class="string">&quot;</span> + i + <span class="string">&quot;</span><span class="string">, </span><span class="string">&quot;</span> + j + <span class="string">&quot;</span><span class="string">) </span><span class="string">&quot;</span>);
System.out.println(<span class="string">&quot;&quot;</span>);
++i;
}
}
}
</pre></body>
</html>

View File

@@ -0,0 +1,46 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>WhileNested3.java</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
<!--
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
table {color: #888888; background-color: #313335; font-family: monospace; font-weight: bold}
.number {color: #6897bb}
.string {color: #6a8759}
.comment {color: #808080}
.whitespace {color: #505050}
.literal {color: #cc7832}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Assignments/lab12_CalebFontenot/src/lab12_calebfontenot/WhileNested3.java</td></tr></table>
<pre>
<span class="comment">/*</span>
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license</span>
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template</span>
<span class="comment"> */</span>
<span class="literal">package</span> lab12_calebfontenot;
<span class="comment">/**</span>
<span class="comment"> *</span>
<span class="comment"> * </span><span class="comment">@author</span> <span class="comment">caleb</span>
<span class="comment">*/</span>
<span class="literal">public</span> <span class="literal">class</span> WhileNested3 {
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> main(String[] args)
{
<span class="literal">for</span> (<span class="literal">int</span> i = <span class="number">0</span>; i &lt; <span class="number">3</span>; ++i)
{
System.out.print(<span class="string">&quot;</span><span class="string">(i, j) = </span><span class="string">&quot;</span>);
<span class="literal">for</span> (<span class="literal">int</span> j = <span class="number">0</span>; j &lt; <span class="number">4</span>; ++j)
System.out.print(<span class="string">&quot;</span><span class="string">(</span><span class="string">&quot;</span> + i + <span class="string">&quot;</span><span class="string">, </span><span class="string">&quot;</span> + j + <span class="string">&quot;</span><span class="string">) </span><span class="string">&quot;</span>);
System.out.println(<span class="string">&quot;&quot;</span>);
}
}
}
</pre></body>
</html>

View 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="lab12_CalebFontenot" default="default" basedir=".">
<description>Builds, tests, and runs the project lab12_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="lab12_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>

View File

@@ -0,0 +1,3 @@
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
build.xml.data.CRC32=17a8d3a4
build.xml.script.CRC32=a9e1d374
build.xml.stylesheet.CRC32=f85dc8f2@1.104.0.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=17a8d3a4
nbproject/build-impl.xml.script.CRC32=c0af7950
nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.104.0.48

View File

@@ -0,0 +1,95 @@
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.modulepath=\
${run.modulepath}
debug.test.classpath=\
${run.test.classpath}
debug.test.modulepath=\
${run.test.modulepath}
# 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}/lab12_CalebFontenot.jar
dist.javadoc.dir=${dist.dir}/javadoc
dist.jlink.dir=${dist.dir}/jlink
dist.jlink.output=${dist.jlink.dir}/lab12_CalebFontenot
excludes=
includes=**
jar.compress=false
javac.classpath=
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.external.vm=true
javac.modulepath=
javac.processormodulepath=
javac.processorpath=\
${javac.classpath}
javac.source=1.8
javac.target=1.8
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
javac.test.modulepath=\
${javac.modulepath}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.html5=false
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
# The jlink additional root modules to resolve
jlink.additionalmodules=
# The jlink additional command line parameters
jlink.additionalparam=
jlink.launcher=true
jlink.launcher.name=lab12_CalebFontenot
main.class=lab12_calebfontenot.Lab12_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.modulepath=\
${javac.modulepath}
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
run.test.modulepath=\
${javac.test.modulepath}
source.encoding=UTF-8
src.dir=src
test.src.dir=test

View 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>lab12_CalebFontenot</name>
<source-roots>
<root id="src.dir"/>
</source-roots>
<test-roots>
<root id="test.src.dir"/>
</test-roots>
</data>
</configuration>
</project>

View File

@@ -0,0 +1,24 @@
/*
* 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 lab12_calebfontenot;
/**
*
* @author caleb
*/
public class ForNested1 {
public static void main(String[] args)
{
for (int i = 0; i < 3; ++i)
{
System.out.print("(i, j) = ");
for (int j = 0; j < 4; ++j)
{
System.out.print("(" + i + ", " + j + ") ");
}
System.out.println("");
}
}
}

View File

@@ -0,0 +1,21 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template
*/
package lab12_calebfontenot;
/**
*
* @author caleb
*/
public class Lab12_CalebFontenot {
/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
// TODO code application logic here
}
}

View File

@@ -0,0 +1,30 @@
/*
* 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 lab12_calebfontenot;
/**
*
* @author caleb
*/
public class NestedForPatternA {
public static void main(String[] args)
{
/*
String line = "";
//First for loop
for (int i = 1; i <= 6; ++i)
{
line = line + " " + i;
System.out.println(line);
}
*/
for (int i = 1; i < 7; i++) {
for (int j = 1; j < i + 1; j++) {
System.out.print(j + " ");
}
System.out.println();
}
}
}

View File

@@ -0,0 +1,30 @@
/*
* 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 lab12_calebfontenot;
/**
*
* @author caleb
*/
public class NestedForPatternB {
public static void main(String[] args)
{
/*
String line = "";
//First for loop
for (int i = 1; i <= 6; ++i)
{
line = line + " " + i;
System.out.println(line);
}
*/
for (int i = 6; i > 0; i--) {
for (int j = 1; j < i + 1; j++) {
System.out.print(j + " ");
}
System.out.println();
}
}
}

View File

@@ -0,0 +1,37 @@
/*
* 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 lab12_calebfontenot;
/**
*
* @author caleb
*/
public class NestedForPyramid {
public static void main(String[] args) {
int startRight = 0, //Init decending numbers
endSpace = 7; //Init number of whitespaces to pad
// PRIMARY FOR LOOP
for (int row = 1; row <= 128; row += row) {
// Whitespace Moment
for (int startSpace = 0; startSpace < endSpace; startSpace++) {
System.out.print(" ");
}
// Display ascending numbers
for (int l = 1; l <= row; l += l) {
System.out.printf("%4d", (l));
}
// Display decending numbers
for (int r = startRight; r > 0; r /= 2) {
System.out.printf("%4d", (r));
}
System.out.println();
endSpace--;
startRight = row;
}
}
}

View File

@@ -0,0 +1,37 @@
/*
* 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 lab12_calebfontenot;
/**
*
* @author caleb
*/
public class NestedWhilePatternC {
public static void main(String[] args) {
// Define variables
int numberOfLines = 6;
int rows = 1;
int spacing;
int collums;
//Main while looping
while (rows <= numberOfLines) {
spacing = numberOfLines - rows;
while (spacing >= 1) { //Spacing
System.out.print(" ");
spacing--;
}
collums = rows;
while (collums >= 1) { //Number printing
System.out.print(collums + " ");
collums--;
}
System.out.println();
rows++;
}
}
}

View File

@@ -0,0 +1,37 @@
/*
* 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 lab12_calebfontenot;
/**
*
* @author caleb
*/
public class NestedWhilePatternD {
public static void main(String[] args) {
// Define variables
int numberOfLines = 6;
int rows = 1;
int spacing;
int collums;
//Main while looping
while (rows <= numberOfLines) {
spacing = numberOfLines - rows;
while (spacing < 6) { //Spacing
System.out.print(" ");
spacing++;
}
collums = rows;
while (collums <= 6) { // Number printing
System.out.print((collums - rows + 1) + " ");
collums++;
}
System.out.println();
rows++;
}
}
}

View File

@@ -0,0 +1,46 @@
/*
* 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 lab12_calebfontenot;
import java.util.Scanner;
/**
*
* @author caleb
*/
public class Palindrome1 {
public static void main(String[] args) {
// Create a Scanner
Scanner input = new Scanner(System.in);
// Prompt the user to enter a string
System.out.print("Enter a string: ");
String s = input.nextLine();
// The index of the first character in the string
int low = 0;
// The index of the last character in the string
int high = s.length() - 1;
boolean isPalindrome = true;
while (low < high) {
if (s.charAt(low) != s.charAt(high)) {
isPalindrome = false;
break;
}
low++;
high--;
}
if (isPalindrome) {
System.out.println(s + " is a palindrome");
} else {
System.out.println(s + " is not a palindrome");
}
}
}

View File

@@ -0,0 +1,46 @@
/*
* 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 lab12_calebfontenot;
import java.util.Scanner;
/**
*
* @author caleb
*/
public class Palindrome2 {
public static void main(String[] args) {
// Create a Scanner
Scanner input = new Scanner(System.in);
// Prompt the user to enter a string
System.out.print("Enter a string: ");
String s = input.nextLine();
// The index of the first character in the string
int low;
// The index of the last character in the string
int high = s.length() - 1;
boolean isPalindrome = true;
for (low = 0; low < high; low++) {
if (s.charAt(low) != s.charAt(high)) {
isPalindrome = false;
break;
}
//low++;
high--;
}
if (isPalindrome) {
System.out.println(s + " is a palindrome");
} else {
System.out.println(s + " is not a palindrome");
}
}
}

View File

@@ -0,0 +1,28 @@
/*
* 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 lab12_calebfontenot;
/**
*
* @author caleb
*/
public class TestBreak1 {
public static void main(String[] args) {
int sum = 0,
number = 0;
while (number < 20) {
if (sum >= 100) {
break;
}
number++;
sum += number;
System.out.println("Current sum: " + sum);
}
System.out.println("\nThe number is " + number);
System.out.println("The sum is " + sum);
}
}

View File

@@ -0,0 +1,28 @@
/*
* 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 lab12_calebfontenot;
/**
*
* @author caleb
*/
public class TestBreak2 {
public static void main(String[] args) {
int sum = 0,
number; // Define number here intead of inside the for loop so that 'number' doesn't get removed from memory the second the for loop is broken out of.
for (number = 0; number < 20; number++) {
if (sum >= 100) {
break;
}
sum += number;
System.out.println("Current sum: " + sum);
}
System.out.println("\nThe number is " + number);
System.out.println("The sum is " + sum);
}
}

View File

@@ -0,0 +1,26 @@
/*
* 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 lab12_calebfontenot;
/**
*
* @author caleb
*/
public class TestContinue1 {
public static void main(String[] args) {
int sum = 0,
number = 0;
while (number < 20) {
number++;
sum += number;
if (number == 10 || number == 11) {
continue;
}
}
System.out.println(number);
System.out.println("The sum is " + sum);
}
}

View File

@@ -0,0 +1,25 @@
/*
* 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 lab12_calebfontenot;
/**
*
* @author caleb
*/
public class TestContinue2 {
public static void main(String[] args) {
int sum = 0,
number;
for (number = 0; number < 20; number++) {
sum += number;
if (number == 10 || number == 11) {
continue;
}
}
System.out.println(number);
System.out.println("The sum is " + sum);
}
}

View File

@@ -0,0 +1,24 @@
/*
* 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 lab12_calebfontenot;
/**
*
* @author caleb
*/
public class WhileNested2 {
public static void main(String[] args)
{
int i = 0;
while (i < 3)
{
System.out.print("(i, j) = ");
for (int j = 0; j < 4; ++j)
System.out.print("(" + i + ", " + j + ") ");
System.out.println("");
++i;
}
}
}

View File

@@ -0,0 +1,22 @@
/*
* 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 lab12_calebfontenot;
/**
*
* @author caleb
*/
public class WhileNested3 {
public static void main(String[] args)
{
for (int i = 0; i < 3; ++i)
{
System.out.print("(i, j) = ");
for (int j = 0; j < 4; ++j)
System.out.print("(" + i + ", " + j + ") ");
System.out.println("");
}
}
}