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,86 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>DayOfTheWeek.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: monospace}
pre {color: #000000; background-color: #ffffff; font-family: monospace}
table {color: #404040; background-color: #e9e8e2; font-family: monospace}
.ST1 {color: #969696; font-family: monospace; font-weight: bold}
.ST2 {font-family: monospace; font-weight: bold}
.comment {color: #969696}
.ST3 {font-family: monospace; font-weight: bold; font-style: italic}
.ST4 {color: #ce54b8; font-family: monospace; font-style: italic}
.ST0 {color: #287bde}
.string {color: #1e9347}
.ST5 {color: #1e9347; font-family: monospace; font-weight: bold}
.literal {color: #336bdd}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">C:\Users\ar114\Documents\NetBeansProjects\Exam1_CalebFontenot\src\main\java\com\calebfontenot\exam1_calebfontenot\DayOfTheWeek.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> com.calebfontenot.exam1_calebfontenot;
<span class="literal">import</span> java.util.Scanner;
<span class="comment">/**</span>
<span class="comment"> *</span>
<span class="comment"> * </span><span class="ST1">@author</span> <span class="comment">ar114</span>
<span class="comment">*/</span>
<span class="literal">public</span> <span class="literal">class</span> <span class="ST2">DayOfTheWeek</span> {
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST3">main</span>(String[] args) {
Scanner input = <span class="literal">new</span> Scanner(System.<span class="ST4">in</span>);
System.<span class="ST4">out</span>.print(<span class="string">&quot;</span><span class="ST5">\n</span><span class="ST5">\n</span><span class="string"> Enter year (e.g. 2008): </span><span class="string">&quot;</span>);
<span class="literal">int</span> year = input.nextInt();
System.<span class="ST4">out</span>.print(<span class="string">&quot;</span><span class="string">Enter month 1-12: </span><span class="string">&quot;</span>);
<span class="literal">int</span> month = input.nextInt();
<span class="literal">if</span> (month == 1) {
month = 13;
year = year - 1;
}
<span class="literal">else</span> <span class="literal">if</span> (month == 2) {
month = 14;
year = year - 1;
}
System.<span class="ST4">out</span>.println(<span class="string">&quot;</span><span class="string">Enter the day of the month: 1-31: </span><span class="string">&quot;</span>);
<span class="literal">int</span> dayOfMonth = input.nextInt();
<span class="literal">int</span> j = year / 100;
<span class="literal">int</span> k = year % 100;
<span class="literal">int</span> dayOfWeek = (dayOfMonth
+ 26 * (month + 1) / 10 + k + k / 4 + j / 4 + 5 * j) % 7;
<span class="literal">if</span> (dayOfWeek == 0) {
System.<span class="ST4">out</span>.println(<span class="string">&quot;</span><span class="string">Day of the week is Saturday</span><span class="string">&quot;</span>);
}
<span class="literal">else</span> <span class="literal">if</span> (dayOfWeek == 1) {
System.<span class="ST4">out</span>.println(<span class="string">&quot;</span><span class="string">Day of the week is Sunday</span><span class="string">&quot;</span>);
}
<span class="literal">else</span> <span class="literal">if</span> (dayOfWeek == 2) {
System.<span class="ST4">out</span>.println(<span class="string">&quot;</span><span class="string">Day of the week is Monday</span><span class="string">&quot;</span>);
}
<span class="literal">else</span> <span class="literal">if</span> (dayOfWeek == 3) {
System.<span class="ST4">out</span>.println(<span class="string">&quot;</span><span class="string">Day of the week is Tuesday</span><span class="string">&quot;</span>);
}
<span class="literal">else</span> <span class="literal">if</span> (dayOfWeek == 4) {
System.<span class="ST4">out</span>.println(<span class="string">&quot;</span><span class="string">Day of the week is Wednesday</span><span class="string">&quot;</span>);
}
<span class="literal">else</span> <span class="literal">if</span> (dayOfWeek == 5) {
System.<span class="ST4">out</span>.println(<span class="string">&quot;</span><span class="string">Day of the week is Thursday</span><span class="string">&quot;</span>);
}
<span class="literal">else</span> <span class="literal">if</span> (dayOfWeek == 6) {
System.<span class="ST4">out</span>.println(<span class="string">&quot;</span><span class="string">Day of the week is Friday</span><span class="string">&quot;</span>);
}
}
}
</pre></body>
</html>

View File

@@ -0,0 +1,71 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>RandomMonth.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: monospace}
pre {color: #000000; background-color: #ffffff; font-family: monospace}
table {color: #404040; background-color: #e9e8e2; font-family: monospace}
.ST1 {color: #969696; font-family: monospace; font-weight: bold}
.ST2 {font-family: monospace; font-weight: bold}
.comment {color: #969696}
.ST3 {font-family: monospace; font-weight: bold; font-style: italic}
.ST4 {font-family: monospace; font-style: italic}
.ST5 {color: #ce54b8; font-family: monospace; font-style: italic}
.ST0 {color: #287bde}
.string {color: #1e9347}
.literal {color: #336bdd}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">C:\Users\ar114\Documents\NetBeansProjects\Exam1_CalebFontenot\src\main\java\com\calebfontenot\exam1_calebfontenot\RandomMonth.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> com.calebfontenot.exam1_calebfontenot;
<span class="comment">/**</span>
<span class="comment"> *</span>
<span class="comment"> * </span><span class="ST1">@author</span> <span class="comment">ar114</span>
<span class="comment">*/</span>
<span class="literal">public</span> <span class="literal">class</span> <span class="ST2">RandomMonth</span> {
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST3">main</span>(String[] args) {
<span class="literal">int</span> number = (<span class="literal">int</span>) (Math.<span class="ST4">random</span>() * 12 + 1);
System.<span class="ST5">out</span>.println(<span class="string">&quot;</span><span class="string">Random generated number is: </span><span class="string">&quot;</span> + number);
<span class="literal">switch</span> (number) {
<span class="literal">case</span> 1:
System.<span class="ST5">out</span>.println(<span class="string">&quot;</span><span class="string">Month is January</span><span class="string">&quot;</span>); <span class="literal">break</span>;
<span class="literal">case</span> 2:
System.<span class="ST5">out</span>.println(<span class="string">&quot;</span><span class="string">Month is February</span><span class="string">&quot;</span>); <span class="literal">break</span>;
<span class="literal">case</span> 3:
System.<span class="ST5">out</span>.println(<span class="string">&quot;</span><span class="string">Month is March</span><span class="string">&quot;</span>); <span class="literal">break</span>;
<span class="literal">case</span> 4:
System.<span class="ST5">out</span>.println(<span class="string">&quot;</span><span class="string">Month is April</span><span class="string">&quot;</span>); <span class="literal">break</span>;
<span class="literal">case</span> 5:
System.<span class="ST5">out</span>.println(<span class="string">&quot;</span><span class="string">Month is May</span><span class="string">&quot;</span>); <span class="literal">break</span>;
<span class="literal">case</span> 6:
System.<span class="ST5">out</span>.println(<span class="string">&quot;</span><span class="string">Month is June</span><span class="string">&quot;</span>); <span class="literal">break</span>;
<span class="literal">case</span> 7:
System.<span class="ST5">out</span>.println(<span class="string">&quot;</span><span class="string">Month is July</span><span class="string">&quot;</span>); <span class="literal">break</span>;
<span class="literal">case</span> 8:
System.<span class="ST5">out</span>.println(<span class="string">&quot;</span><span class="string">Month is August</span><span class="string">&quot;</span>); <span class="literal">break</span>;
<span class="literal">case</span> 9:
System.<span class="ST5">out</span>.println(<span class="string">&quot;</span><span class="string">Month is September</span><span class="string">&quot;</span>); <span class="literal">break</span>;
<span class="literal">case</span> 10:
System.<span class="ST5">out</span>.println(<span class="string">&quot;</span><span class="string">Month is October</span><span class="string">&quot;</span>); <span class="literal">break</span>;
<span class="literal">case</span> 11:
System.<span class="ST5">out</span>.println(<span class="string">&quot;</span><span class="string">Month is November</span><span class="string">&quot;</span>); <span class="literal">break</span>;
<span class="literal">case</span> 12:
System.<span class="ST5">out</span>.println(<span class="string">&quot;</span><span class="string">Month is December</span><span class="string">&quot;</span>); <span class="literal">break</span>;
}
}
}
</pre></body>
</html>

View File

@@ -0,0 +1,61 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>TrianglePerimeter.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: monospace}
pre {color: #000000; background-color: #ffffff; font-family: monospace}
table {color: #404040; background-color: #e9e8e2; font-family: monospace}
.ST1 {color: #969696; font-family: monospace; font-weight: bold}
.ST2 {font-family: monospace; font-weight: bold}
.comment {color: #969696}
.ST3 {font-family: monospace; font-weight: bold; font-style: italic}
.ST4 {color: #ce54b8; font-family: monospace; font-style: italic}
.ST0 {color: #287bde}
.string {color: #1e9347}
.literal {color: #336bdd}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">C:\Users\ar114\Documents\NetBeansProjects\Exam1_CalebFontenot\src\main\java\com\calebfontenot\exam1_calebfontenot\TrianglePerimeter.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> com.calebfontenot.exam1_calebfontenot;
<span class="literal">import</span> java.util.Scanner;
<span class="comment">/**</span>
<span class="comment"> *</span>
<span class="comment"> * </span><span class="ST1">@author</span> <span class="comment">ar114</span>
<span class="comment">*/</span>
<span class="literal">public</span> <span class="literal">class</span> <span class="ST2">TrianglePerimeter</span> {
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST3">main</span>(String[] args) {
<span class="comment">// Create scanner</span>
Scanner input = <span class="literal">new</span> Scanner(System.<span class="ST4">in</span>);
<span class="comment">// Define variables</span>
<span class="literal">int</span> triEdge1, triEdge2, triEdge3;
<span class="comment">// Prompt for input</span>
System.<span class="ST4">out</span>.print(<span class="string">&quot;</span><span class="string">Enter 3 edges for a triangle: </span><span class="string">&quot;</span>);
triEdge1 = input.nextInt();
triEdge2 = input.nextInt();
triEdge3 = input.nextInt();
<span class="comment">// Compute and print output</span>
System.<span class="ST4">out</span>.println(((triEdge1 + triEdge2) &gt; triEdge3) ||
((triEdge1 + triEdge3) &gt; triEdge2) ||
((triEdge2 + triEdge3) &gt; triEdge1) ?
<span class="string">&quot;</span><span class="string">Input is valid</span><span class="string">&quot;</span> : <span class="string">&quot;</span><span class="string">Invalid Input</span><span class="string">&quot;</span>);
}
}
</pre></body>
</html>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.calebfontenot.exam1_calebfontenot</groupId>
<artifactId>Exam1_CalebFontenot</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<exec.mainClass>com.calebfontenot.exam1_calebfontenot.Exam1_CalebFontenot</exec.mainClass>
</properties>
</project>

View File

@@ -0,0 +1,58 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package com.calebfontenot.exam1_calebfontenot;
import java.util.Scanner;
/**
*
* @author ar114
*/
public class DayOfTheWeek {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("\n\n Enter year (e.g. 2008): ");
int year = input.nextInt();
System.out.print("Enter month 1-12: ");
int month = input.nextInt();
if (month == 1) {
month = 13;
year = year - 1;
}
else if (month == 2) {
month = 14;
year = year - 1;
}
System.out.println("Enter the day of the month: 1-31: ");
int dayOfMonth = input.nextInt();
int j = year / 100;
int k = year % 100;
int dayOfWeek = (dayOfMonth
+ 26 * (month + 1) / 10 + k + k / 4 + j / 4 + 5 * j) % 7;
if (dayOfWeek == 0) {
System.out.println("Day of the week is Saturday");
}
else if (dayOfWeek == 1) {
System.out.println("Day of the week is Sunday");
}
else if (dayOfWeek == 2) {
System.out.println("Day of the week is Monday");
}
else if (dayOfWeek == 3) {
System.out.println("Day of the week is Tuesday");
}
else if (dayOfWeek == 4) {
System.out.println("Day of the week is Wednesday");
}
else if (dayOfWeek == 5) {
System.out.println("Day of the week is Thursday");
}
else if (dayOfWeek == 6) {
System.out.println("Day of the week is Friday");
}
}
}

View File

@@ -0,0 +1,17 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Project/Maven2/JavaApp/src/main/java/${packagePath}/${mainClassName}.java to edit this template
*/
package com.calebfontenot.exam1_calebfontenot;
/**
*
* @author ar114
*/
public class Exam1_CalebFontenot {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}

View File

@@ -0,0 +1,43 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package com.calebfontenot.exam1_calebfontenot;
/**
*
* @author ar114
*/
public class RandomMonth {
public static void main(String[] args) {
int number = (int) (Math.random() * 12 + 1);
System.out.println("Random generated number is: " + number);
switch (number) {
case 1:
System.out.println("Month is January"); break;
case 2:
System.out.println("Month is February"); break;
case 3:
System.out.println("Month is March"); break;
case 4:
System.out.println("Month is April"); break;
case 5:
System.out.println("Month is May"); break;
case 6:
System.out.println("Month is June"); break;
case 7:
System.out.println("Month is July"); break;
case 8:
System.out.println("Month is August"); break;
case 9:
System.out.println("Month is September"); break;
case 10:
System.out.println("Month is October"); break;
case 11:
System.out.println("Month is November"); break;
case 12:
System.out.println("Month is December"); break;
}
}
}

View File

@@ -0,0 +1,34 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package com.calebfontenot.exam1_calebfontenot;
import java.util.Scanner;
/**
*
* @author ar114
*/
public class TrianglePerimeter {
public static void main(String[] args) {
// Create scanner
Scanner input = new Scanner(System.in);
// Define variables
int triEdge1, triEdge2, triEdge3;
// Prompt for input
System.out.print("Enter 3 edges for a triangle: ");
triEdge1 = input.nextInt();
triEdge2 = input.nextInt();
triEdge3 = input.nextInt();
// Compute and print output
System.out.println(((triEdge1 + triEdge2) > triEdge3) ||
((triEdge1 + triEdge3) > triEdge2) ||
((triEdge2 + triEdge3) > triEdge1) ?
"Input is valid" : "Invalid Input");
}
}

View File

@@ -0,0 +1,72 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Problem1.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}
.ST4 {color: #ce7b00; font-family: Monospaced; font-weight: bold}
.string {color: #ce7b00}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">C:\Users\ar114\Documents\NetBeansProjects\Exam2_CalebFontenot\src\exam2_calebfontenot\Problem1.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> exam2_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">Problem1</span> {
<span class="comment">/**</span>
<span class="comment"> * </span><span class="ST0">@param</span> args <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> <span class="ST2">main</span>(String[] args) {
<span class="comment">// Define variables</span>
<span class="literal">double</span> userInput = 0, average = 0;
<span class="literal">int</span> timesRun = 0;
<span class="comment">// Create scanner</span>
Scanner input = <span class="literal">new</span> Scanner(System.<span class="ST3">in</span>);
System.<span class="ST3">out</span>.println(<span class="string">&quot;</span><span class="string">I will calculate the average of numbers you will enter. </span><span class="ST4">\n</span><span class="string">&quot;</span>);
<span class="comment">// While loop to grab inputs and calculate</span>
<span class="literal">while</span> (userInput != -1) {
System.<span class="ST3">out</span>.print(<span class="string">&quot;</span><span class="string">Enter a positive number, or type -1 to quit: </span><span class="string">&quot;</span>);
userInput = input.nextDouble();
<span class="literal">if</span> (userInput != -1) {
<span class="comment">// Calculate average</span>
average += userInput;
<span class="comment">// Increment timesRun</span>
timesRun++;
}
}
average = average / (<span class="literal">double</span>) timesRun;
System.<span class="ST3">out</span>.println(<span class="string">&quot;</span><span class="string">The average is: </span><span class="string">&quot;</span> + average);
}
}
</pre></body>
</html>

View File

@@ -0,0 +1,49 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Problem2.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 {font-family: Monospaced; font-weight: bold}
.ST1 {font-family: Monospaced; font-weight: bold; font-style: italic}
.ST2 {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\Exam2_CalebFontenot\src\exam2_calebfontenot\Problem2.java</td></tr></table>
<pre>
<span class="literal">package</span> exam2_calebfontenot;
<span class="literal">public</span> <span class="literal">class</span> <span class="ST0">Problem2</span> {
<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> i = 1;
<span class="literal">do</span> {
<span class="literal">int</span> j = i;
<span class="literal">while</span> (j &gt; 1) {
System.<span class="ST2">out</span>.print(<span class="string">&quot;</span> <span class="string">&quot;</span>);
j--;
}
j = 1;
<span class="literal">while</span> (j &lt;= 6 + 1 - i) {
j++;
<span class="literal">if</span> (i % 2 == 0) {
<span class="literal">continue</span>;
}
System.<span class="ST2">out</span>.print((j - 1) + <span class="string">&quot;</span> <span class="string">&quot;</span>);
}
System.<span class="ST2">out</span>.println();
i++;
} <span class="literal">while</span> ( i &lt;= 6);
}
}
</pre></body>
</html>

View File

@@ -0,0 +1,75 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Problem3.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\Exam2_CalebFontenot\src\exam2_calebfontenot\Problem3.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> exam2_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">Problem3</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">// Create scanner</span>
Scanner input = <span class="literal">new</span> Scanner(System.<span class="ST3">in</span>);
<span class="comment">// Define args</span>
<span class="literal">int</span> currentPrime = 0, timesToIterate = 0, timesIncremented = 0;
<span class="literal">while</span> (timesToIterate != -1) {
System.<span class="ST3">out</span>.print(<span class="string">&quot;</span> <span class="string">&quot;</span> + <span class="string">&quot;</span><span class="string">===&gt; -1 to quit or enter the number of primes you need generated and i will print 10 per line: </span><span class="string">&quot;</span>);
<span class="comment">// Get amount of times the user wants us to iterate for.</span>
timesToIterate = input.nextInt();
<span class="comment">// Don&#39;t do anything if the input is -1</span>
<span class="literal">if</span> (timesToIterate != -1) {
<span class="comment">// First loop. This determines how many times to iterate.</span>
<span class="literal">for</span> (<span class="literal">int</span> i = 0; i &lt;= timesToIterate; i++) {
currentPrime++;
<span class="comment">// It&#39;s broken somewhere here, but I&#39;m not sure where exactly...</span>
<span class="comment">// Generate primes by incrementing currentPrime and attempting to divide by itself. </span>
<span class="literal">for</span> (<span class="literal">int</span> j = 1; j &lt; timesIncremented; j++) {
<span class="literal">if</span> (currentPrime % j == 0) {
System.<span class="ST3">out</span>.print(currentPrime + <span class="string">&quot;</span> <span class="string">&quot;</span>);
}
timesIncremented++;
<span class="comment">// If we&#39;ve incremented 10 times, print a new line.</span>
<span class="literal">if</span> (timesIncremented % 10 == 0) {
System.<span class="ST3">out</span>.println();
}
}
}
}
}
}
}
</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="Exam2_CalebFontenot" default="default" basedir=".">
<description>Builds, tests, and runs the project Exam2_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="Exam2_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=a1961f55
build.xml.script.CRC32=e222b254
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=a1961f55
nbproject/build-impl.xml.script.CRC32=57382989
nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.104.0.48

View File

@@ -0,0 +1,86 @@
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}/Exam2_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.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.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
main.class=exam2_calebfontenot.Problem1
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>Exam2_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,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 exam2_calebfontenot;
import java.util.Scanner;
/**
*
* @author ar114
*/
public class Problem1 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// Define variables
double userInput = 0, average = 0;
int timesRun = 0;
// Create scanner
Scanner input = new Scanner(System.in);
System.out.println("I will calculate the average of numbers you will enter. \n");
// While loop to grab inputs and calculate
while (userInput != -1) {
System.out.print("Enter a positive number, or type -1 to quit: ");
userInput = input.nextDouble();
if (userInput != -1) {
// Calculate average
average += userInput;
// Increment timesRun
timesRun++;
}
}
average = average / (double) timesRun;
System.out.println("The average is: " + average);
}
}

View File

@@ -0,0 +1,25 @@
package exam2_calebfontenot;
public class Problem2 {
public static void main(String[] args) {
int i = 1;
do {
int j = i;
while (j > 1) {
System.out.print(" ");
j--;
}
j = 1;
while (j <= 6 + 1 - i) {
j++;
if (i % 2 == 0) {
continue;
}
System.out.print((j - 1) + " ");
}
System.out.println();
i++;
} while ( i <= 6);
}
}

View File

@@ -0,0 +1,53 @@
/*
* 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 exam2_calebfontenot;
import java.util.Scanner;
/**
*
* @author ar114
*/
public class Problem3 {
public static void main(String[] args) {
// Create scanner
Scanner input = new Scanner(System.in);
// Define args
int currentPrime = 0, timesToIterate = 0, timesIncremented = 0;
while (timesToIterate != -1) {
System.out.print(" " + "===> -1 to quit or enter the number of primes you need generated and i will print 10 per line: ");
// Get amount of times the user wants us to iterate for.
timesToIterate = input.nextInt();
// Don't do anything if the input is -1
if (timesToIterate != -1) {
// First loop. This determines how many times to iterate.
for (int i = 0; i <= timesToIterate; i++) {
currentPrime++;
// It's broken somewhere here, but I'm not sure where exactly...
// Generate primes by incrementing currentPrime and attempting to divide by itself.
for (int j = 1; j < timesIncremented; j++) {
if (currentPrime % j == 0) {
System.out.print(currentPrime + " ");
}
timesIncremented++;
// If we've incremented 10 times, print a new line.
if (timesIncremented % 10 == 0) {
System.out.println();
}
}
}
}
}
}
}

View File

@@ -0,0 +1,9 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# Linux start script should use lf
/gradlew text eol=lf
# These are Windows script files and should use crlf
*.bat text eol=crlf

View File

@@ -0,0 +1,5 @@
# Ignore Gradle project-specific cache directory
.gradle
# Ignore Gradle build output directory
build

View File

@@ -0,0 +1,35 @@
/*
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Java application project to get you started.
* For more details take a look at the 'Building Java & JVM projects' chapter in the Gradle
* User Manual available at https://docs.gradle.org/7.5/userguide/building_java_projects.html
*/
plugins {
// Apply the application plugin to add support for building a CLI application in Java.
id 'application'
}
repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
}
dependencies {
// Use JUnit Jupiter for testing.
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.2'
// This dependency is used by the application.
implementation 'com.google.guava:guava:31.0.1-jre'
}
application {
// Define the main class for the application.
mainClass = 'Exam2_Practice_CalebFontenot.App'
}
tasks.named('test') {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
}

View File

@@ -0,0 +1,11 @@
/*
* This Java source file was generated by the Gradle 'init' task.
*/
package Exam2_Practice_CalebFontenot;
public class App {
public static void main(String[] args) {
System.out.println("hi");
}
}

View File

@@ -0,0 +1,48 @@
/*
* 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 Exam2_Practice_CalebFontenot;
/**
*
* @author caleb
*/
public class PrintArrayReversedEven {
public static void main(String[] args)
{
printRE(new int[] {1, 2, 3});
printRE(new int[2]);
printRE(new int[] {2, 4, 7, 8});
}
public static void printRE(int[] array) {
int arrayLength = 0;
for (int i = 0; i < array.length - 1; i++) {
// determine array length.
if (array[i] % 2 == 0) {
arrayLength++;
}
}
// Now create the return array.
int[] returnArray = new int[arrayLength];
int arrayI = 0;
for (int i = 0; i < array.length - 1; i++) {
if (array[i] % 2 == 0) {
// Add even numbers to array.
returnArray[arrayI] = array[i];
arrayI++;
}
}
// Reverse items in the array.
int[] reversedReturnArray = new int[arrayI];
int reverseArrayIterable = arrayI - 1;
for (int i = 0; i < returnArray.length - 1; i++) {
reversedReturnArray[reverseArrayIterable] = returnArray[i];
reverseArrayIterable--;
}
// Now print the array.
for (int i = 0; i > reversedReturnArray.length - 1; i++) {
System.out.print(reversedReturnArray[i] + " ");
}
}
}

View File

@@ -0,0 +1,14 @@
/*
* This Java source file was generated by the Gradle 'init' task.
*/
package Exam2_Practice_CalebFontenot;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class AppTest {
@Test void appHasAGreeting() {
App classUnderTest = new App();
}
}

View File

@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -0,0 +1,240 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

View File

@@ -0,0 +1,91 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@@ -0,0 +1,11 @@
/*
* This file was generated by the Gradle 'init' task.
*
* The settings file is used to specify which projects to include in your build.
*
* Detailed information about configuring a multi-project build in Gradle can be found
* in the user manual at https://docs.gradle.org/7.5/userguide/multi_project_builds.html
*/
rootProject.name = 'Exam2_Practice_CalebFontenot'
include('app')

View File

@@ -0,0 +1,92 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Consecutive4Equals.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}
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace}
table {color: #888888; background-color: #313335; font-family: monospace}
.ST4 {color: #9876aa}
.string {color: #6a8759}
.number {color: #6897bb}
.comment {color: #808080}
.whitespace {color: #505050}
.ST2 {color: #ffc66d; font-family: monospace; font-style: italic}
.ST3 {color: #9876aa; font-family: monospace; font-style: italic}
.ST1 {color: #808080; font-family: monospace; font-weight: bold}
.ST0 {color: #287bde}
.literal {color: #cc7832}
.ST5 {font-family: monospace; font-style: italic}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Exams/Exam2_mvn_Practice_CalebFontenot/src/main/java/com/calebfontenot/exam2_mvn_practice_calebfontenot/Consecutive4Equals.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> com.calebfontenot.exam2_mvn_practice_calebfontenot;
<span class="comment">/**</span>
<span class="comment"> *</span>
<span class="comment"> * </span><span class="ST1">@author</span> <span class="comment">caleb</span>
<span class="comment">*/</span>
<span class="literal">public</span> <span class="literal">class</span> Consecutive4Equals {
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST2">main</span>(String[] args)
{
java.util.Scanner input = <span class="literal">new</span> java.util.Scanner(System.<span class="ST3">in</span>);
<span class="literal">while</span> (<span class="literal">true</span>) {
System.<span class="ST3">out</span>.print(<span class="string">&quot;</span><span class="string">Enter the number of values, -1 to quit: </span><span class="string">&quot;</span>);
<span class="literal">int</span> size = input.nextInt();
<span class="literal">if</span> (size == -<span class="number">1</span>) {
System.<span class="ST3">out</span>.println(<span class="string">&quot;</span><span class="string">goodbye!</span><span class="string">&quot;</span>);
<span class="literal">break</span>;
}
<span class="literal">int</span>[] values = <span class="literal">new</span> <span class="literal">int</span>[size];
System.<span class="ST3">out</span>.print(<span class="string">&quot;</span><span class="string">Enter the values: </span><span class="string">&quot;</span>);
<span class="literal">for</span> (<span class="literal">int</span> i = <span class="number">0</span>; i &lt; values.<span class="ST4">length</span>; i++) {
values[i] = input.nextInt();
}
<span class="literal">if</span> (<span class="ST5">isConsecutiveFour</span>(values)) {
System.<span class="ST3">out</span>.println(<span class="string">&quot;</span><span class="string">The list has consecutive fours.</span><span class="string">&quot;</span>);
} <span class="literal">else</span> {
System.<span class="ST3">out</span>.println(<span class="string">&quot;</span><span class="string">The list has no consecutive fours.</span><span class="string">&quot;</span>);
}
}
}
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">boolean</span> <span class="ST2">isConsecutiveFour</span>(<span class="literal">int</span>[] values)
{
<span class="literal">int</span> numOccurance = <span class="number">0</span>;
<span class="literal">int</span> iterable = <span class="number">0</span>;
<span class="literal">int</span> consecutiveFourDetected = <span class="number">0</span>;
<span class="literal">for</span> (<span class="literal">int</span> i = <span class="number">0</span>; i &lt; values.<span class="ST4">length</span> - <span class="number">1</span>; i++) {
<span class="literal">if</span> (values[i] == values[iterable]) {
numOccurance++;
<span class="literal">if</span> (i != <span class="number">0</span>) {
iterable++;
}
} <span class="literal">else</span> {
numOccurance = <span class="number">0</span>;
}
<span class="literal">if</span> (numOccurance &gt;= <span class="number">4</span>) {
consecutiveFourDetected++;
}
}
<span class="literal">if</span> (consecutiveFourDetected != <span class="number">0</span>) {
<span class="literal">return</span> <span class="literal">true</span>;
}
<span class="literal">else</span> {
<span class="literal">return</span> <span class="literal">false</span>;
}
}
}
</pre></body>
</html>

View File

@@ -0,0 +1,79 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>PrintArrayReversedEven.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}
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace}
table {color: #888888; background-color: #313335; font-family: monospace}
.ST4 {color: #9876aa}
.number {color: #6897bb}
.string {color: #6a8759}
.comment {color: #808080}
.whitespace {color: #505050}
.ST2 {color: #ffc66d; font-family: monospace; font-style: italic}
.ST5 {color: #9876aa; font-family: monospace; font-style: italic}
.ST1 {color: #808080; font-family: monospace; font-weight: bold}
.ST0 {color: #287bde}
.literal {color: #cc7832}
.ST3 {font-family: monospace; font-style: italic}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Exams/Exam2_mvn_Practice_CalebFontenot/src/main/java/com/calebfontenot/exam2_mvn_practice_calebfontenot/PrintArrayReversedEven.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> com.calebfontenot.exam2_mvn_practice_calebfontenot;
<span class="comment">/**</span>
<span class="comment"> *</span>
<span class="comment"> * </span><span class="ST1">@author</span> <span class="comment">caleb</span>
<span class="comment">*/</span>
<span class="literal">public</span> <span class="literal">class</span> PrintArrayReversedEven {
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST2">main</span>(String[] args)
{
<span class="ST3">printRE</span>(<span class="literal">new</span> <span class="literal">int</span>[] {<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>});
<span class="ST3">printRE</span>(<span class="literal">new</span> <span class="literal">int</span>[<span class="number">2</span>]);
<span class="ST3">printRE</span>(<span class="literal">new</span> <span class="literal">int</span>[] {<span class="number">2</span>, <span class="number">4</span>, <span class="number">7</span>, <span class="number">8</span>});
}
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST2">printRE</span>(<span class="literal">int</span>[] array) {
<span class="literal">int</span> arrayLength = <span class="number">0</span>;
<span class="literal">for</span> (<span class="literal">int</span> i = <span class="number">0</span>; i &lt;= array.<span class="ST4">length</span> - <span class="number">1</span>; i++) {
<span class="comment">// determine array length.</span>
<span class="literal">if</span> (array[i] % <span class="number">2</span> == <span class="number">0</span>) {
arrayLength++;
}
}
<span class="comment">// Now create the return array.</span>
<span class="literal">int</span>[] returnArray = <span class="literal">new</span> <span class="literal">int</span>[arrayLength];
<span class="literal">int</span> arrayI = <span class="number">0</span>;
<span class="literal">for</span> (<span class="literal">int</span> i = <span class="number">0</span>; i &lt;= array.<span class="ST4">length</span> - <span class="number">1</span>; i++) {
<span class="literal">if</span> (array[i] % <span class="number">2</span> == <span class="number">0</span>) {
<span class="comment">// Add even numbers to array.</span>
returnArray[arrayI] = array[i];
arrayI++;
}
}
<span class="comment">// Reverse items in the array.</span>
<span class="literal">int</span>[] reversedReturnArray = <span class="literal">new</span> <span class="literal">int</span>[arrayI];
<span class="literal">int</span> reverseArrayIterable = arrayI - <span class="number">1</span>;
<span class="literal">for</span> (<span class="literal">int</span> i = <span class="number">0</span>; i &lt;= returnArray.<span class="ST4">length</span> - <span class="number">1</span>; i++) {
reversedReturnArray[reverseArrayIterable] = returnArray[i];
reverseArrayIterable--;
}
<span class="comment">// Now print the array.</span>
<span class="literal">for</span> (<span class="literal">int</span> i = <span class="number">0</span>; i &lt;= reversedReturnArray.<span class="ST4">length</span> - <span class="number">1</span>; i++) {
System.<span class="ST5">out</span>.print(reversedReturnArray[i] + <span class="string">&quot;</span> <span class="string">&quot;</span>);
}
System.<span class="ST5">out</span>.println();
}
}
</pre></body>
</html>

View File

@@ -0,0 +1,78 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>SortCharsInString.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}
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace}
table {color: #888888; background-color: #313335; font-family: monospace}
.ST3 {color: #9876aa}
.number {color: #6897bb}
.string {color: #6a8759}
.comment {color: #808080}
.whitespace {color: #505050}
.ST2 {color: #ffc66d; font-family: monospace; font-style: italic}
.ST4 {color: #9876aa; font-family: monospace; font-style: italic}
.ST1 {color: #808080; font-family: monospace; font-weight: bold}
.ST0 {color: #287bde}
.literal {color: #cc7832}
.ST5 {font-family: monospace; font-style: italic}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Exams/Exam2_mvn_Practice_CalebFontenot/src/main/java/com/calebfontenot/exam2_mvn_practice_calebfontenot/SortCharsInString.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> com.calebfontenot.exam2_mvn_practice_calebfontenot;
<span class="comment">/**</span>
<span class="comment"> *</span>
<span class="comment"> * </span><span class="ST1">@author</span> <span class="comment">caleb</span>
<span class="comment">*/</span>
<span class="literal">public</span> <span class="literal">class</span> SortCharsInString {
<span class="literal">public</span> <span class="literal">static</span> String <span class="ST2">sort</span>(String s)
{
<span class="comment">// Read string chars, and sort them</span>
<span class="literal">char</span> array[] = s.toCharArray();
<span class="literal">char</span> temp;
<span class="literal">int</span> i = <span class="number">0</span>;
<span class="literal">while</span> (i &lt; array.<span class="ST3">length</span>) {
<span class="literal">int</span> j = i + <span class="number">1</span>;
<span class="literal">while</span> (j &lt; array.<span class="ST3">length</span>) {
<span class="comment">// Compare each char, if one is larger, swap them</span>
<span class="literal">if</span> (array[j] &lt; array[i]) {
temp = array[i];
array[i] = array[j];
array[j] = temp;
}
j += <span class="number">1</span>;
}
i += <span class="number">1</span>;
}
<span class="comment">// Rebuild string</span>
String rebuiltString = <span class="string">&quot;&quot;</span>;
<span class="literal">for</span> (<span class="literal">char</span> charInArray : array) {
rebuiltString += charInArray;
}
<span class="literal">return</span> rebuiltString;
}
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST2">main</span>(String[] args)
{
java.util.Scanner input = <span class="literal">new</span> java.util.Scanner(System.<span class="ST4">in</span>);
System.<span class="ST4">out</span>.print(<span class="string">&quot;</span><span class="string">Enter a string: </span><span class="string">&quot;</span>);
String s = input.nextLine();
System.<span class="ST4">out</span>.println(<span class="string">&quot;</span><span class="string">Sorted string is </span><span class="string">&quot;</span> + <span class="ST5">sort</span>(s));
}
}
</pre></body>
</html>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.calebfontenot</groupId>
<artifactId>Exam2_mvn_Practice_CalebFontenot</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<exec.mainClass>com.calebfontenot.exam2_mvn_practice_calebfontenot.Exam2_mvn_Practice_CalebFontenot</exec.mainClass>
</properties>
</project>

View File

@@ -0,0 +1,62 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package com.calebfontenot.exam2_mvn_practice_calebfontenot;
/**
*
* @author caleb
*/
public class Consecutive4Equals {
public static void main(String[] args)
{
java.util.Scanner input = new java.util.Scanner(System.in);
while (true) {
System.out.print("Enter the number of values, -1 to quit: ");
int size = input.nextInt();
if (size == -1) {
System.out.println("goodbye!");
break;
}
int[] values = new int[size];
System.out.print("Enter the values: ");
for (int i = 0; i < values.length; i++) {
values[i] = input.nextInt();
}
if (isConsecutiveFour(values)) {
System.out.println("The list has consecutive fours.");
} else {
System.out.println("The list has no consecutive fours.");
}
}
}
public static boolean isConsecutiveFour(int[] values)
{
int numOccurance = 0;
int iterable = 0;
int consecutiveFourDetected = 0;
for (int i = 0; i < values.length - 1; i++) {
if (values[i] == values[iterable]) {
numOccurance++;
if (i != 0) {
iterable++;
}
} else {
numOccurance = 0;
}
if (numOccurance >= 4) {
consecutiveFourDetected++;
}
}
if (consecutiveFourDetected != 0) {
return true;
}
else {
return false;
}
}
}

View File

@@ -0,0 +1,17 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Project/Maven2/JavaApp/src/main/java/${packagePath}/${mainClassName}.java to edit this template
*/
package com.calebfontenot.exam2_mvn_practice_calebfontenot;
/**
*
* @author caleb
*/
public class Exam2_mvn_Practice_CalebFontenot {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}

View File

@@ -0,0 +1,49 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package com.calebfontenot.exam2_mvn_practice_calebfontenot;
/**
*
* @author caleb
*/
public class PrintArrayReversedEven {
public static void main(String[] args)
{
printRE(new int[] {1, 2, 3});
printRE(new int[2]);
printRE(new int[] {2, 4, 7, 8});
}
public static void printRE(int[] array) {
int arrayLength = 0;
for (int i = 0; i <= array.length - 1; i++) {
// determine array length.
if (array[i] % 2 == 0) {
arrayLength++;
}
}
// Now create the return array.
int[] returnArray = new int[arrayLength];
int arrayI = 0;
for (int i = 0; i <= array.length - 1; i++) {
if (array[i] % 2 == 0) {
// Add even numbers to array.
returnArray[arrayI] = array[i];
arrayI++;
}
}
// Reverse items in the array.
int[] reversedReturnArray = new int[arrayI];
int reverseArrayIterable = arrayI - 1;
for (int i = 0; i <= returnArray.length - 1; i++) {
reversedReturnArray[reverseArrayIterable] = returnArray[i];
reverseArrayIterable--;
}
// Now print the array.
for (int i = 0; i <= reversedReturnArray.length - 1; i++) {
System.out.print(reversedReturnArray[i] + " ");
}
System.out.println();
}
}

View File

@@ -0,0 +1,48 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package com.calebfontenot.exam2_mvn_practice_calebfontenot;
/**
*
* @author caleb
*/
public class SortCharsInString {
public static String sort(String s)
{
// Read string chars, and sort them
char array[] = s.toCharArray();
char temp;
int i = 0;
while (i < array.length) {
int j = i + 1;
while (j < array.length) {
// Compare each char, if one is larger, swap them
if (array[j] < array[i]) {
temp = array[i];
array[i] = array[j];
array[j] = temp;
}
j += 1;
}
i += 1;
}
// Rebuild string
String rebuiltString = "";
for (char charInArray : array) {
rebuiltString += charInArray;
}
return rebuiltString;
}
public static void main(String[] args)
{
java.util.Scanner input = new java.util.Scanner(System.in);
System.out.print("Enter a string: ");
String s = input.nextLine();
System.out.println("Sorted string is " + sort(s));
}
}

Binary file not shown.

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.calebfontenot</groupId>
<artifactId>ExamPractice</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>18</maven.compiler.source>
<maven.compiler.target>18</maven.compiler.target>
<exec.mainClass>com.calebfontenot.exampractice.ExamPractice</exec.mainClass>
</properties>
</project>

View File

@@ -0,0 +1,68 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package com.calebfontenot.exampractice;
import java.util.Scanner;
/**
*
* @author caleb
*/
public class AscendingOrderOf3 {
public static void main(String[] args)
{
// Create scanner
Scanner input = new Scanner(System.in);
//Define variables
int x, y, z;
int firstNumber=-1, secondNumber=-1, thirdNumber=-1;
// Prompt for input
System.out.print("Enter a 3 integers: ");
x = input.nextInt();
y = input.nextInt();
z = input.nextInt();
// Compute!
if (x <= y && x <= z) {// Check if x is greater than y && y is greater than z
System.out.println("1st if condition met");
firstNumber = x;
if (y <= z) {
secondNumber = y;
thirdNumber = z;
}
else {
secondNumber = z;
thirdNumber = y;
}
}
if (y <= x && y <= z) {
System.out.println("2nd if condition met");
firstNumber = y;
if (x <= z) {
secondNumber = x;
thirdNumber = z;
}
else {
secondNumber = z;
thirdNumber = x;
}
}
if (z <= y && z <= x) {
System.out.println("3rd if condition met");
firstNumber = z;
if (z <= x) {
secondNumber = y;
thirdNumber = x;
}
else {
secondNumber = x;
thirdNumber = y;
}
}
// Output
System.out.println(firstNumber + ", " + secondNumber + ", " + thirdNumber);
}
}

View File

@@ -0,0 +1,23 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Project/Maven2/JavaApp/src/main/java/${packagePath}/${mainClassName}.java to edit this template
*/
package com.calebfontenot.exampractice;
/**
*
* @author caleb
*/
public class ExamPractice {
public static void main(String[] args)
{
int numberPicker;
char letter;
while (true) {
numberPicker = (int) (Math.random() * 0x7F);
letter = (char) numberPicker;
System.out.println(letter);
}
}
}

View File

@@ -0,0 +1,61 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>AgesOf3Daughters.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: Ubuntu}
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: Ubuntu}
table {color: #888888; background-color: #313335; font-family: Ubuntu}
.literal {color: #cc7832}
.ST0 {color: #287bde}
.number {color: #6897bb}
.string {color: #6a8759}
.comment {color: #808080}
.whitespace {color: #505050}
.ST2 {color: #ffc66d; font-family: Ubuntu; font-style: italic}
.ST3 {color: #9876aa; font-family: Ubuntu; font-style: italic}
.ST1 {color: #808080; font-family: Ubuntu; font-weight: bold}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Exams/PracticeExam2/src/practiceexam2/AgesOf3Daughters.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> practiceexam2;
<span class="literal">import</span> java.util.Scanner;
<span class="comment">/**</span>
<span class="comment"> *</span>
<span class="comment"> * </span><span class="ST1">@author</span> <span class="comment">caleb</span>
<span class="comment">*/</span>
<span class="literal">public</span> <span class="literal">class</span> AgesOf3Daughters {
<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">// Create scanner</span>
Scanner input = <span class="literal">new</span> Scanner(System.<span class="ST3">in</span>);
<span class="literal">int</span> product = <span class="number">0</span>, <span class="comment">sum</span>;
<span class="literal">while</span> (product != -<span class="number">1</span>) {
System.<span class="ST3">out</span>.print(<span class="string">&quot;</span><span class="string">Enter the product and then the sum of the ages of the 3 daughters or -1 to quit: </span><span class="string">&quot;</span>);
product = input.nextInt();
sum = input.nextInt();
<span class="literal">if</span> (product % <span class="number">3</span> == <span class="number">0</span>) {
}
<span class="literal">else</span> {
System.<span class="ST3">out</span>.println(<span class="string">&quot;</span><span class="string">Invalid input</span><span class="string">&quot;</span>);
}
}
}
}
</pre></body>
</html>

View File

@@ -0,0 +1,66 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>CharsToUnicodeWhile.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: Ubuntu}
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: Ubuntu}
table {color: #888888; background-color: #313335; font-family: Ubuntu}
.literal {color: #cc7832}
.ST0 {color: #287bde}
.string {color: #6a8759}
.number {color: #6897bb}
.comment {color: #808080}
.whitespace {color: #505050}
.ST2 {color: #ffc66d; font-family: Ubuntu; font-style: italic}
.ST3 {color: #9876aa; font-family: Ubuntu; font-style: italic}
.ST1 {color: #808080; font-family: Ubuntu; font-weight: bold}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Exams/PracticeExam2/src/practiceexam2/CharsToUnicodeWhile.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> practiceexam2;
<span class="literal">import</span> java.util.Scanner;
<span class="comment">/**</span>
<span class="comment"> *</span>
<span class="comment"> * </span><span class="ST1">@author</span> <span class="comment">caleb</span>
<span class="comment">*/</span>
<span class="literal">public</span> <span class="literal">class</span> CharsToUnicodeWhile {
<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>
String toUnicode = <span class="string">&quot;&quot;</span>;
<span class="comment">// Create scanner</span>
Scanner input = <span class="literal">new</span> Scanner(System.<span class="ST3">in</span>);
<span class="literal">while</span> (!toUnicode.toLowerCase().equals(<span class="string">&quot;</span><span class="string">q</span><span class="string">&quot;</span>)) {
<span class="comment">// Prompt for input</span>
System.<span class="ST3">out</span>.print(<span class="string">&quot;</span><span class="string">Enter a string of characters to convert them to UNICODE or Q/q to quit this program: </span><span class="string">&quot;</span>);
toUnicode = input.next();
<span class="literal">if</span> (toUnicode.toLowerCase().equals(<span class="string">&quot;</span><span class="string">q</span><span class="string">&quot;</span>)) {
<span class="literal">break</span>;
}
System.<span class="ST3">out</span>.print(toUnicode + <span class="string">&quot;</span><span class="string"> in UNICODE is: </span><span class="string">&quot;</span>);
<span class="literal">for</span> (<span class="literal">int</span> x = <span class="number">0</span>; x &lt; toUnicode.length(); x++) {
System.<span class="ST3">out</span>.print(((<span class="literal">int</span>) toUnicode.charAt(x)) + <span class="string">&quot;</span> <span class="string">&quot;</span>);
}
System.<span class="ST3">out</span>.println();
}
System.<span class="ST3">out</span>.println(<span class="string">&quot;</span><span class="string">Goodbye!</span><span class="string">&quot;</span>);
}
}
</pre></body>
</html>

View File

@@ -0,0 +1,60 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>TransformToDOWhileLoops.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: Ubuntu}
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: Ubuntu}
table {color: #888888; background-color: #313335; font-family: Ubuntu}
.literal {color: #cc7832}
.ST0 {color: #287bde}
.number {color: #6897bb}
.string {color: #6a8759}
.comment {color: #808080}
.whitespace {color: #505050}
.ST2 {color: #ffc66d; font-family: Ubuntu; font-style: italic}
.ST3 {color: #9876aa; font-family: Ubuntu; font-style: italic}
.ST1 {color: #808080; font-family: Ubuntu; font-weight: bold}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Exams/PracticeExam2/src/practiceexam2/TransformToDOWhileLoops.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> practiceexam2;
<span class="comment">/**</span>
<span class="comment"> *</span>
<span class="comment"> * </span><span class="ST1">@author</span> <span class="comment">caleb</span>
<span class="comment">*/</span>
<span class="literal">public</span> <span class="literal">class</span> TransformToDOWhileLoops {
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST2">main</span>(String[] args)
{
<span class="literal">int</span> i = <span class="number">1</span>;
<span class="literal">do</span> {
<span class="literal">int</span> j = <span class="number">1</span>;
<span class="literal">do</span> {
j += <span class="number">2</span>;
<span class="literal">if</span> (i % <span class="number">2</span> == <span class="number">0</span>) {
<span class="literal">continue</span>;
}
System.<span class="ST3">out</span>.print(j + <span class="string">&quot;</span> <span class="string">&quot;</span>);
} <span class="literal">while</span> (j &lt;= i + <span class="number">1</span>);
System.<span class="ST3">out</span>.println();
++i;
} <span class="literal">while</span> (i &lt;= <span class="number">9</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="PracticeExam2" default="default" basedir=".">
<description>Builds, tests, and runs the project PracticeExam2.</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="PracticeExam2-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=0e000e4e
build.xml.script.CRC32=ba27af4b
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=0e000e4e
nbproject/build-impl.xml.script.CRC32=7494d4e6
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}/PracticeExam2.jar
dist.javadoc.dir=${dist.dir}/javadoc
dist.jlink.dir=${dist.dir}/jlink
dist.jlink.output=${dist.jlink.dir}/PracticeExam2
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=PracticeExam2
main.class=practiceexam2.PracticeExam2
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>PracticeExam2</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,33 @@
/*
* 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 practiceexam2;
import java.util.Scanner;
/**
*
* @author caleb
*/
public class AgesOf3Daughters {
public static void main(String[] args)
{
// Create scanner
Scanner input = new Scanner(System.in);
int product = 0, sum;
while (product != -1) {
System.out.print("Enter the product and then the sum of the ages of the 3 daughters or -1 to quit: ");
product = input.nextInt();
sum = input.nextInt();
if (product % 3 == 0) {
}
else {
System.out.println("Invalid input");
}
}
}
}

View File

@@ -0,0 +1,38 @@
/*
* 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 practiceexam2;
import java.util.Scanner;
/**
*
* @author caleb
*/
public class CharsToUnicodeWhile {
public static void main(String[] args)
{
// Define variables
String toUnicode = "";
// Create scanner
Scanner input = new Scanner(System.in);
while (!toUnicode.toLowerCase().equals("q")) {
// Prompt for input
System.out.print("Enter a string of characters to convert them to UNICODE or Q/q to quit this program: ");
toUnicode = input.next();
if (toUnicode.toLowerCase().equals("q")) {
break;
}
System.out.print(toUnicode + " in UNICODE is: ");
for (int x = 0; x < toUnicode.length(); x++) {
System.out.print(((int) toUnicode.charAt(x)) + " ");
}
System.out.println();
}
System.out.println("Goodbye!");
}
}

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 practiceexam2;
/**
*
* @author caleb
*/
public class PracticeExam2 {
/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
// TODO code application logic here
}
}

View File

@@ -0,0 +1,32 @@
/*
* 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 practiceexam2;
/**
*
* @author caleb
*/
public class TransformToDOWhileLoops {
public static void main(String[] args)
{
int i = 1;
do {
int j = 1;
do {
j += 2;
if (i % 2 == 0) {
continue;
}
System.out.print(j + " ");
} while (j <= i + 1);
System.out.println();
++i;
} while (i <= 9);
}
}

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="PracticeExamChapter6_CalebFontenot" default="default" basedir=".">
<description>Builds, tests, and runs the project PracticeExamChapter6_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="PracticeExamChapter6_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=580a15b3
build.xml.script.CRC32=4eab36d8
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=580a15b3
nbproject/build-impl.xml.script.CRC32=5b534ab6
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}/PracticeExamChapter6_CalebFontenot.jar
dist.javadoc.dir=${dist.dir}/javadoc
dist.jlink.dir=${dist.dir}/jlink
dist.jlink.output=${dist.jlink.dir}/PracticeExamChapter6_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=PracticeExamChapter6_CalebFontenot
main.class=practiceexamchapter6_calebfontenot.PracticeExamChapter6_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>PracticeExamChapter6_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,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 practiceexamchapter6_calebfontenot;
/**
*
* @author caleb
*/
public class PracticeExamChapter6_CalebFontenot {
/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
}
}

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 practiceexamchapter6_calebfontenot.methods_test;
/**
*
* @author caleb
*/
public class Increment {
public static void main(String[] args) {
int x = 1;
System.out.println("Before the call, x is " + x);
increment(x);
System.out.println("After the call, x is " + x);
}
public static void increment(int n) {
n++;
System.out.println("n inside the method is " + n);
}
}

View File

@@ -0,0 +1,44 @@
/*
* 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 practiceexamchapter6_calebfontenot.methods_test;
/**
*
* @author caleb
*/
public class Methods {
public static int maxOf3(int x, int y, int z)
{
if (x > y) {
if (x > z) {
return x;
} else {
return z;
}
} else if (y > z) {
return y;
} else {
return z;
}
// return -1;
}
public static void printMessage(String message, int howManyTimes) {
for (int i = 0; i < howManyTimes; ++i) {
System.out.println(message);
}
}
public static void main(String[] args)
{
//printMessage("the good, the bad, and the ugly", 100000);
System.out.println(maxOf3(3, 2, 1));
System.out.println(maxOf3(1, 2, 3));
System.out.println(maxOf3(1, 1, 1));
System.out.println(Methods.maxOf3(1, 2, 3));
}
}

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>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">&quot;</span><span class="string">Enter a year: </span><span class="string">&quot;</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) &amp;&amp; (year % 100 != 0 )|| (year % 400 == 0));
<span class="comment">// Display the result</span>
System.<span class="ST3">out</span>.println(year + <span class="string">&quot;</span><span class="string"> is a leap year? </span><span class="string">&quot;</span> + isLeapYear);
}
}
</pre></body>
</html>

View 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">&quot;</span><span class="string">Enter 2 variables and I will calculate the </span><span class="string">&quot;</span>
+ <span class="string">&quot;</span><span class="string">quotient and the remainder: </span><span class="string">&quot;</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">&quot;</span><span class="string">The quotient is: </span><span class="string">&quot;</span> + quotient);
System.<span class="ST3">out</span>.println(<span class="string">&quot;</span><span class="string">The remainder is: </span><span class="string">&quot;</span> + remainder);
}
}
</pre></body>
</html>

View File

@@ -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">&quot;</span><span class="string">Enter 2 variables and I will calculate the </span><span class="string">&quot;</span>
+ <span class="string">&quot;</span><span class="string">quotient and the remainder: </span><span class="string">&quot;</span>);
number1 = input.nextInt();
number2 = input.nextInt();
<span class="comment">// Compute!</span>
<span class="literal">if</span> (number1 &lt;= number2) {
System.<span class="ST3">out</span>.println(number1 + <span class="string">&quot;</span><span class="string"> &lt; </span><span class="string">&quot;</span> + number2 + <span class="string">&quot;</span><span class="string">!</span><span class="string">&quot;</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">&quot;</span><span class="string"> / </span><span class="string">&quot;</span> + number2 + <span class="string">&quot;</span><span class="string"> =</span><span class="string">&quot;</span>);
System.<span class="ST3">out</span>.println(<span class="string">&quot;</span><span class="string">The quotient is: </span><span class="string">&quot;</span> + quotient);
System.<span class="ST3">out</span>.println(<span class="string">&quot;</span><span class="string">The remainder is: </span><span class="string">&quot;</span> + remainder);
}
}
</pre></body>
</html>

View 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">&quot;</span><span class="string">Enter 3 numbers: </span><span class="string">&quot;</span>);
_1 = input.nextInt();
_2 = input.nextInt();
_3 = input.nextInt();
<span class="comment">// Compute!</span>
<span class="literal">if</span> (_1 &lt;= _3 &amp; _2 &lt;= _3) { <span class="comment">// Is _3 the largest?</span>
firstLargest = _3; <span class="comment">// Yes!</span>
<span class="literal">if</span> (_2 &gt;= _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 &lt;= _2 &amp; _1 &lt;= _2) { <span class="comment">// Is _2 the largest?</span>
firstLargest = _2; <span class="comment">// Yes!</span>
<span class="literal">if</span> (_3 &gt;= _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 &lt;= _1 &amp; _2 &lt;= _1) { <span class="comment">// Is _1 the largest?</span>
firstLargest = _1; <span class="comment">// Yes!</span>
<span class="literal">if</span> (_3 &gt;= _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">&quot;</span><span class="string">Some numbers equal. Running additional checks...</span><span class="string">&quot;</span>);
<span class="literal">if</span> (_1 == _2) {
<span class="literal">if</span> (_1 &gt; _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 &gt; _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 &gt; _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">&quot;</span><span class="string">The first largest is </span><span class="string">&quot;</span> + firstLargest + <span class="string">&quot;</span><span class="string"> and the second largest is </span><span class="string">&quot;</span> + secondLargest);
}
}
}
</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="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>

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=bc1262b2
build.xml.script.CRC32=17222dbe
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=bc1262b2
nbproject/build-impl.xml.script.CRC32=14e0d152
nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.104.0.48

View File

@@ -0,0 +1,86 @@
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}/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.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.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.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>ProgrammingExam1_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,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);
}
}

View File

@@ -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
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -0,0 +1,82 @@
/*
* 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);
}
}
}