Old Exam studying stuff
This commit is contained in:
parent
c9d6ca2982
commit
3476dd253a
76
Assignments/lab14_CalebFontenot/PrimeNumbers.html
Normal file
76
Assignments/lab14_CalebFontenot/PrimeNumbers.html
Normal file
@ -0,0 +1,76 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>PrimeNumbers.java</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
|
||||
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
|
||||
table {color: #888888; background-color: #313335; font-family: monospace; font-weight: bold}
|
||||
.string {color: #6a8759}
|
||||
.number {color: #6897bb}
|
||||
.comment {color: #808080}
|
||||
.whitespace {color: #505050}
|
||||
.ST1 {color: #ffc66d; font-family: monospace; font-weight: bold; font-style: italic}
|
||||
.ST2 {color: #9876aa; font-family: monospace; font-weight: bold; font-style: italic}
|
||||
.ST0 {color: #287bde}
|
||||
.literal {color: #cc7832}
|
||||
.ST3 {font-family: monospace; font-weight: bold; font-style: italic}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Assignments/lab14_CalebFontenot/src/lab14_calebfontenot/PrimeNumbers.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> lab14_calebfontenot;
|
||||
|
||||
<span class="comment">/**</span>
|
||||
<span class="comment"> *</span>
|
||||
<span class="comment"> * </span><span class="comment">@author</span> <span class="comment">caleb</span>
|
||||
<span class="comment">*/</span>
|
||||
<span class="literal">public</span> <span class="literal">class</span> PrimeNumbers {
|
||||
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST1">main</span>(String[] args)
|
||||
{
|
||||
System.<span class="ST2">out</span>.println(<span class="string">"</span><span class="string">The first 50 prime numbers are: </span><span class="literal">\n</span><span class="string">"</span>);
|
||||
<span class="ST3">printPrimeNumbers</span>(<span class="number">5</span><span class="number">0</span>);
|
||||
}
|
||||
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST1">printPrimeNumbers</span>(<span class="literal">int</span> numberOfPrimes) {
|
||||
<span class="literal">final</span> <span class="literal">int</span> NUMBER_OF_PRIMES_PER_LINE = <span class="number">10</span>; <span class="comment">// Display 10 per line</span>
|
||||
<span class="literal">int</span> count = <span class="number">0</span>; <span class="comment">// Count the number of prime numbers</span>
|
||||
<span class="literal">int</span> number = <span class="number">1</span>; <span class="comment">// A number to be tested for primeness</span>
|
||||
|
||||
<span class="comment">//> Repeatedly find prime numbers</span>
|
||||
<span class="literal">while</span> (count < numberOfPrimes) {
|
||||
<span class="comment">//>> Print the prime number and increase the count</span>
|
||||
<span class="literal">if</span> (<span class="ST3">isPrime</span>(number)) {
|
||||
count++; <span class="comment">// Increase the count</span>
|
||||
<span class="literal">if</span> (count % NUMBER_OF_PRIMES_PER_LINE == <span class="number">0</span>) {
|
||||
<span class="comment">//>> Print the number and advance to the new line</span>
|
||||
System.<span class="ST2">out</span>.printf(<span class="string">"</span><span class="string">%-5d</span><span class="literal">\n</span><span class="string">"</span>, number);
|
||||
}
|
||||
<span class="literal">else</span> {
|
||||
System.<span class="ST2">out</span>.printf(<span class="string">"</span><span class="string">%-5d</span><span class="string">"</span>, number);
|
||||
}
|
||||
}
|
||||
<span class="comment">//>> Check if the next number is prime</span>
|
||||
number++;
|
||||
}
|
||||
}
|
||||
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">boolean</span> <span class="ST1">isPrime</span>(<span class="literal">int</span> number) {
|
||||
<span class="literal">for</span> (<span class="literal">int</span> divisor = <span class="number">2</span>; divisor <= number / <span class="number">2</span>; divisor++) {
|
||||
<span class="literal">if</span> (number % divisor == <span class="number">0</span>) {
|
||||
<span class="comment">// If true, number is not prime</span>
|
||||
<span class="literal">return</span> <span class="literal">false</span>;
|
||||
}
|
||||
}
|
||||
<span class="literal">return</span> <span class="literal">true</span>; <span class="comment">// number is prime</span>
|
||||
}
|
||||
}
|
||||
|
||||
</pre></body>
|
||||
</html>
|
153
Assignments/lab14_CalebFontenot/StaticMethods.html
Normal file
153
Assignments/lab14_CalebFontenot/StaticMethods.html
Normal file
@ -0,0 +1,153 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>StaticMethods.java</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
|
||||
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
|
||||
table {color: #888888; background-color: #313335; font-family: monospace; font-weight: bold}
|
||||
.number {color: #6897bb}
|
||||
.string {color: #6a8759}
|
||||
.comment {color: #808080}
|
||||
.whitespace {color: #505050}
|
||||
.ST1 {color: #9876aa; font-family: monospace; font-weight: bold; font-style: italic}
|
||||
.ST2 {color: #ffc66d; font-family: monospace; font-weight: bold; font-style: italic}
|
||||
.ST0 {color: #287bde}
|
||||
.literal {color: #cc7832}
|
||||
.ST3 {font-family: monospace; font-weight: bold; font-style: italic}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Assignments/lab14_CalebFontenot/src/lab14_calebfontenot/StaticMethods.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> lab14_calebfontenot;
|
||||
|
||||
<span class="literal">import</span> java.util.Scanner;
|
||||
|
||||
<span class="comment">/**</span>
|
||||
<span class="comment"> *</span>
|
||||
<span class="comment"> * </span><span class="comment">@author</span> <span class="comment">caleb</span>
|
||||
<span class="comment">*/</span>
|
||||
<span class="literal">public</span> <span class="literal">class</span> StaticMethods {
|
||||
<span class="literal">static</span> <span class="literal">int</span> <span class="ST1">executeCount</span> = <span class="number">0</span>;
|
||||
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST2">main</span>(String[] args)
|
||||
{
|
||||
StaticMethods.<span class="ST3">printJava</span>();
|
||||
<span class="literal">for</span> (<span class="literal">int</span> i = <span class="number">0</span>; i < <span class="number">20</span>; i++) {
|
||||
<span class="literal">for</span> (<span class="literal">int</span> y = <span class="number">0</span>; y < <span class="number">5</span>; y++) {
|
||||
StaticMethods.<span class="ST3">printMyName</span>();
|
||||
}
|
||||
System.<span class="ST1">out</span>.println();
|
||||
}
|
||||
<span class="ST1">executeCount</span> = <span class="number">0</span>;
|
||||
<span class="literal">for</span> (<span class="literal">int</span> i = <span class="number">0</span>; i < <span class="number">50</span>; i++) {
|
||||
<span class="literal">for</span> (<span class="literal">int</span> y = <span class="number">0</span>; y < <span class="number">2</span>; y++) {
|
||||
StaticMethods.<span class="ST3">printMessage</span>(<span class="string">"</span><span class="string">Java is fun!</span><span class="string">"</span>);
|
||||
}
|
||||
System.<span class="ST1">out</span>.println();
|
||||
}
|
||||
|
||||
System.<span class="ST1">out</span>.println(StaticMethods.<span class="ST3">squareNumber</span>(<span class="number">5</span>));
|
||||
System.<span class="ST1">out</span>.println(StaticMethods.<span class="ST3">squareNumber</span>(<span class="number">5</span><span class="number">.0</span>));
|
||||
System.<span class="ST1">out</span>.println(StaticMethods.<span class="ST3">cubeNumber</span>(<span class="number">5</span>));
|
||||
System.<span class="ST1">out</span>.println(StaticMethods.<span class="ST3">cubeNumber</span>(<span class="number">5</span><span class="number">.0</span>));
|
||||
System.<span class="ST1">out</span>.println(StaticMethods.<span class="ST3">menu</span>());
|
||||
|
||||
|
||||
<span class="literal">char</span> menuReturn = StaticMethods.<span class="ST3">menu</span>();
|
||||
<span class="literal">if</span> (menuReturn == <span class="string">'</span><span class="string">c</span><span class="string">'</span>) {
|
||||
System.<span class="ST1">out</span>.println(StaticMethods.<span class="ST3">cubeNumber</span>(<span class="number">5</span>));
|
||||
System.<span class="ST1">out</span>.println(StaticMethods.<span class="ST3">cubeNumber</span>(<span class="number">5</span><span class="number">.0</span>));
|
||||
} <span class="literal">else</span> <span class="literal">if</span> (menuReturn == <span class="string">'</span><span class="string">s</span><span class="string">'</span>) {
|
||||
System.<span class="ST1">out</span>.println(StaticMethods.<span class="ST3">squareNumber</span>(<span class="number">5</span>));
|
||||
System.<span class="ST1">out</span>.println(StaticMethods.<span class="ST3">squareNumber</span>(<span class="number">5</span><span class="number">.0</span>));
|
||||
}
|
||||
|
||||
System.<span class="ST1">out</span>.println(StaticMethods.<span class="ST3">menuInteger</span>());
|
||||
|
||||
<span class="comment">// Area</span>
|
||||
Scanner input = <span class="literal">new</span> Scanner(System.<span class="ST1">in</span>);
|
||||
System.<span class="ST1">out</span>.print(<span class="string">"</span><span class="string">Enter the number of sides: </span><span class="string">"</span>);
|
||||
<span class="literal">int</span> n = input.nextInt();
|
||||
System.<span class="ST1">out</span>.print(<span class="string">"</span><span class="string">Enter the side: </span><span class="string">"</span>);
|
||||
<span class="literal">double</span> side = input.nextDouble();
|
||||
<span class="comment">// Call the area function</span>
|
||||
System.<span class="ST1">out</span>.println(<span class="string">"</span><span class="string">The area of the polygon is: </span><span class="string">"</span> + StaticMethods.<span class="ST3">area</span>(n, side));
|
||||
|
||||
}
|
||||
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST2">printJava</span>() {
|
||||
System.<span class="ST1">out</span>.println(<span class="string">"</span><span class="string">Java</span><span class="string">"</span>);
|
||||
}
|
||||
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST2">printMyName</span>() {
|
||||
System.<span class="ST1">out</span>.print(<span class="string">"</span><span class="string">Caleb Fontenot </span><span class="string">"</span>);
|
||||
System.<span class="ST1">out</span>.print(++<span class="ST1">executeCount</span> + <span class="string">"</span> <span class="string">"</span>);
|
||||
}
|
||||
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST2">printMessage</span>(String msg) {
|
||||
System.<span class="ST1">out</span>.print(msg + <span class="string">"</span> <span class="string">"</span>);
|
||||
System.<span class="ST1">out</span>.print(++<span class="ST1">executeCount</span> + <span class="string">"</span> <span class="string">"</span>);
|
||||
}
|
||||
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">int</span> <span class="ST2">squareNumber</span>(<span class="literal">int</span> number) {
|
||||
System.<span class="ST1">out</span>.println(<span class="string">"</span><span class="string">INT (squre) was called</span><span class="string">"</span>);
|
||||
<span class="literal">return</span> number * number;
|
||||
}
|
||||
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">double</span> <span class="ST2">squareNumber</span>(<span class="literal">double</span> number) {
|
||||
System.<span class="ST1">out</span>.println(<span class="string">"</span><span class="string">DOUBLE (square) was called</span><span class="string">"</span>);
|
||||
<span class="literal">return</span> number * number;
|
||||
}
|
||||
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">int</span> <span class="ST2">cubeNumber</span>(<span class="literal">int</span> number) {
|
||||
System.<span class="ST1">out</span>.println(<span class="string">"</span><span class="string">INT (cube) was called</span><span class="string">"</span>);
|
||||
<span class="literal">return</span> number * StaticMethods.<span class="ST3">squareNumber</span>(number);
|
||||
}
|
||||
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">double</span> <span class="ST2">cubeNumber</span>(<span class="literal">double</span> number) {
|
||||
System.<span class="ST1">out</span>.println(<span class="string">"</span><span class="string">DOUBLE (cube) was called</span><span class="string">"</span>);
|
||||
<span class="literal">return</span> number * StaticMethods.<span class="ST3">squareNumber</span>(number);
|
||||
}
|
||||
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">char</span> <span class="ST2">menu</span>() {
|
||||
String s = <span class="string">""</span>;
|
||||
<span class="literal">do</span> {
|
||||
System.<span class="ST1">out</span>.println(<span class="string">"</span><span class="string">type S</span><span class="literal">\\</span><span class="string">s to square a number</span><span class="string">"</span>);
|
||||
System.<span class="ST1">out</span>.println(<span class="string">"</span><span class="string">type C</span><span class="literal">\\</span><span class="string">c to cube a number</span><span class="string">"</span>);
|
||||
System.<span class="ST1">out</span>.print(<span class="string">"</span><span class="string">Input: </span><span class="string">"</span>);
|
||||
s = <span class="literal">new</span> Scanner(System.<span class="ST1">in</span>).next();
|
||||
<span class="literal">if</span> (<span class="string">"</span><span class="string">c</span><span class="string">"</span>.compareToIgnoreCase(s) != <span class="number">0</span> && <span class="string">"</span><span class="string">s</span><span class="string">"</span>.compareToIgnoreCase(s) != <span class="number">0</span>) {
|
||||
System.<span class="ST1">out</span>.println(<span class="string">"</span><span class="literal">\t</span><span class="string">please enter a valid character</span><span class="string">"</span>);
|
||||
}
|
||||
} <span class="literal">while</span> (<span class="string">"</span><span class="string">c</span><span class="string">"</span>.compareToIgnoreCase(s) != <span class="number">0</span> && <span class="string">"</span><span class="string">s</span><span class="string">"</span>.compareToIgnoreCase(s) != <span class="number">0</span>);
|
||||
<span class="literal">return</span> s.toLowerCase().charAt(<span class="number">0</span>);
|
||||
}
|
||||
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">int</span> <span class="ST2">menuInteger</span>() {
|
||||
Scanner input = <span class="literal">new</span> Scanner(System.<span class="ST1">in</span>);
|
||||
<span class="literal">int</span> returnInt = -<span class="number">1</span>;
|
||||
<span class="literal">while</span> (<span class="literal">true</span>) {
|
||||
System.<span class="ST1">out</span>.print(<span class="string">"</span><span class="string">Enter an integer (must be 1000, 2000, or 3000): </span><span class="string">"</span>);
|
||||
returnInt = input.nextInt();
|
||||
<span class="literal">if</span> (returnInt == <span class="number">1000</span>){
|
||||
<span class="literal">return</span> returnInt;
|
||||
}
|
||||
<span class="literal">else</span> <span class="literal">if</span> (returnInt == <span class="number">2000</span>) {
|
||||
<span class="literal">return</span> returnInt;
|
||||
}
|
||||
<span class="literal">else</span> <span class="literal">if</span> (returnInt == <span class="number">3000</span>) {
|
||||
<span class="literal">return</span> returnInt;
|
||||
}
|
||||
<span class="literal">else</span> {
|
||||
System.<span class="ST1">out</span>.println(<span class="string">"</span><span class="string">Integer not allowed, try again</span><span class="string">"</span>);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">double</span> <span class="ST2">area</span>(<span class="literal">int</span> n, <span class="literal">double</span> side) {
|
||||
<span class="comment">// Compute area</span>
|
||||
<span class="literal">return</span> (n * Math.<span class="ST3">pow</span>(side, <span class="number">2</span>)) / (<span class="number">4.0</span> * Math.<span class="ST3">tan</span>(Math.<span class="ST1">PI</span> / n));
|
||||
}
|
||||
}
|
||||
|
||||
</pre></body>
|
||||
</html>
|
@ -28,14 +28,14 @@ public class StaticMethods {
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
/*
|
||||
|
||||
System.out.println(StaticMethods.squareNumber(5));
|
||||
System.out.println(StaticMethods.squareNumber(5.0));
|
||||
System.out.println(StaticMethods.cubeNumber(5));
|
||||
System.out.println(StaticMethods.cubeNumber(5.0));
|
||||
//System.out.println(StaticMethods.menu());
|
||||
*/
|
||||
/*
|
||||
System.out.println(StaticMethods.menu());
|
||||
|
||||
|
||||
char menuReturn = StaticMethods.menu();
|
||||
if (menuReturn == 'c') {
|
||||
System.out.println(StaticMethods.cubeNumber(5));
|
||||
@ -46,7 +46,6 @@ public class StaticMethods {
|
||||
}
|
||||
|
||||
System.out.println(StaticMethods.menuInteger());
|
||||
*/
|
||||
|
||||
// Area
|
||||
Scanner input = new Scanner(System.in);
|
||||
|
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* 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.mycompany.mavenproject1;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class BitwiseOR {
|
||||
|
||||
public static void main(String[] args) {
|
||||
int x = 1;
|
||||
int y = 5;
|
||||
while (y-- > 0 ^ x++ < 100);
|
||||
System.out.println(++x);
|
||||
|
||||
}
|
||||
}
|
@ -13,6 +13,6 @@ public class ByteOverFlow {
|
||||
{
|
||||
byte b = 127;
|
||||
b++;
|
||||
System.out.println(b);
|
||||
System.out.println(b);
|
||||
}
|
||||
}
|
||||
|
@ -9,11 +9,14 @@ package com.mycompany.mavenproject1;
|
||||
* @author caleb
|
||||
*/
|
||||
public class Loop12 {
|
||||
public static void main(String[] args)
|
||||
{
|
||||
for (int i = 0; i < 6; i++)
|
||||
for (int j = 0; j < i; j += 2)
|
||||
System.out.println("java");
|
||||
|
||||
public static void main(String[] args) {
|
||||
int lol = 0;
|
||||
for (int i = 0; i < 6; i++) {
|
||||
for (int j = 0; j < i; j += 2) {
|
||||
System.out.println("java" + ++lol);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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.mycompany.mavenproject1;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class MathRounding {
|
||||
public static void main(String[] args) {
|
||||
Scanner scan = new Scanner(System.in);
|
||||
|
||||
double toRound = 1;
|
||||
|
||||
while (toRound != 0)
|
||||
{
|
||||
System.out.println("Time to find out what this shit does: (hit 0 to fuck off) ");
|
||||
toRound = scan.nextDouble();
|
||||
|
||||
if (toRound == 0)
|
||||
break;
|
||||
|
||||
System.out.println("Math.rint gives you " + Math.rint(toRound));
|
||||
System.out.println("Math.ceil gives you " + Math.ceil(toRound));
|
||||
System.out.println("Math.round gives you " + Math.round(toRound));
|
||||
System.out.println("Math.floor gives you " + Math.floor(toRound));
|
||||
}
|
||||
System.out.println("Goodbye!");
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* 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.mycompany.mavenproject1;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class NegativeChar {
|
||||
public static void main(String[] args) {
|
||||
char lolChar = '\5';
|
||||
System.out.println(lolChar);
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package com.mycompany.mavenproject1;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class Q20 {
|
||||
public static void main(String[] args) {
|
||||
int x = 0;
|
||||
int y = 10;
|
||||
while ( -x > -5)
|
||||
{
|
||||
while ( y % 5 == 0 )
|
||||
{
|
||||
|
||||
y -= 5;
|
||||
if ( y < 0 )
|
||||
break;
|
||||
}
|
||||
x++;
|
||||
}
|
||||
System.out.println(x+y);
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* 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.mycompany.mavenproject1;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class Rint {
|
||||
public static void main(String[] args) {
|
||||
System.out.println( Math.rint(5.5) );
|
||||
System.out.println( Math.rint(4.5) );
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* 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.mycompany.mavenproject1;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class WeirdCharStuff {
|
||||
public static void main(String[] args) {
|
||||
char c = '2' + 2;
|
||||
System.out.println((int) c + 4);
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
ZIPs/lab14_CalebFontenot.zip
Normal file
BIN
ZIPs/lab14_CalebFontenot.zip
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user