master
Caleb Fontenot 2023-04-14 01:01:58 +07:00
parent 6dff1ff71c
commit 56681623cc
28 changed files with 2175 additions and 24 deletions

File diff suppressed because it is too large Load Diff

@ -0,0 +1,41 @@
/*
* 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.mp5_calebfontenot;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Scanner;
/**
*
* @author caleb
*/
public class Large {
public static void main(String[] args) {
// Read data file
// ArrayLists
ArrayList firstNameArr = new ArrayList();
ArrayList lastNameArr = new ArrayList();
ArrayList jobTitleArr = new ArrayList();
ArrayList salaryArr = new ArrayList();
File file = new File("Salary.txt");
try (Scanner fileScanner = new Scanner(file)) {
while (fileScanner.hasNext()) {
firstNameArr.add(fileScanner.next());
lastNameArr.add(fileScanner.next());
jobTitleArr.add(fileScanner.next());
salaryArr.add(fileScanner.next());
fileScanner.nextLine(); // consume newline
}
} catch (Exception ex) {
System.out.println("Unable to read file");
}
for (int i = 0; i < firstNameArr.size(); ++i) {
System.out.println("first name:" + firstNameArr.get(i));
}
}
}

@ -0,0 +1,50 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>OOM.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}
.literal {color: #cc7832}
.number {color: #6897bb}
.string {color: #6a8759}
.comment {color: #808080}
.whitespace {color: #505050}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Semester 2/Assignments/lab7_CalebFontenot/src/main/java/com/calebfontenot/lab7_calebfontenot/OOM.java</td></tr></table>
<pre>
<span class="comment">/*</span>
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license</span>
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template</span>
<span class="comment"> */</span>
<span class="literal">package</span> com.calebfontenot.lab7_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> OOM {
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> main(String[] args)
{
<span class="literal">try</span> {
Integer[][] oomArray = <span class="literal">new</span> Integer[<span class="number">20000</span>][<span class="number">20000</span>];
<span class="literal">for</span> (<span class="literal">int</span> i = <span class="number">0</span>; i &lt; oomArray.length; ++i ) {
<span class="literal">for</span> (<span class="literal">int</span> j = <span class="number">0</span>; j &lt; oomArray.length; ++j ) {
oomArray[i][j] = i * j;
<span class="comment">//System.out.println(oomArray[i][j]);</span>
}
}
} <span class="literal">catch</span> (OutOfMemoryError ex) {
System.out.println(<span class="string">&quot;</span><span class="string">Out of memory! </span><span class="string">&quot;</span> + ex);
}
}
}
</pre></body>
</html>

@ -0,0 +1,75 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>occurrencesOfEachCharacter.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}
.literal {color: #cc7832}
.ST4 {font-family: monospace; font-weight: bold; font-style: italic}
.ST0 {color: #287bde}
.string {color: #6a8759}
.number {color: #6897bb}
.ST3 {color: #9876aa}
.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}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Semester 2/Assignments/lab7_CalebFontenot/src/main/java/com/calebfontenot/lab7_calebfontenot/occurrencesOfEachCharacter.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.lab7_calebfontenot;
<span class="literal">import</span> java.io.File;
<span class="literal">import</span> java.io.FileNotFoundException;
<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> occurrencesOfEachCharacter {
<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="literal">int</span>) <span class="string">&#39;</span><span class="string">a</span><span class="string">&#39;</span> + <span class="string">&quot;</span><span class="string">, </span><span class="string">&quot;</span> + (<span class="literal">int</span>) <span class="string">&#39;</span><span class="string">z</span><span class="string">&#39;</span>);
<span class="comment">// Number array for each letter in alphabet</span>
<span class="literal">int</span>[] letterCount = <span class="literal">new</span> <span class="literal">int</span>[<span class="number">26</span>];
Scanner input = <span class="literal">new</span> Scanner(System.<span class="ST2">in</span>);
System.<span class="ST2">out</span>.print(<span class="string">&quot;</span><span class="string">Enter a path to a file to scan: </span><span class="string">&quot;</span>);
File filePath = <span class="literal">new</span> File(input.nextLine());
<span class="literal">try</span> (Scanner fileScanner = <span class="literal">new</span> Scanner(filePath);) {
<span class="literal">char</span> currentChar;
<span class="literal">int</span> arrayIndex = <span class="number">0</span>;
<span class="comment">//Instruct scanner to delimit at everything</span>
fileScanner.useDelimiter(<span class="string">&quot;</span><span class="string">&quot;</span>);
<span class="literal">while</span> (fileScanner.hasNext()) {
currentChar = fileScanner.next().toLowerCase().charAt(<span class="number">0</span>);
arrayIndex = ((<span class="literal">int</span>) currentChar - <span class="number">97</span>); <span class="comment">//This will determine where in the array to increment at</span>
<span class="comment">//System.out.println(currentChar);</span>
<span class="literal">if</span> (currentChar &gt; <span class="string">&#39;</span><span class="string">a</span><span class="string">&#39;</span> &amp; currentChar &lt; <span class="string">&#39;</span><span class="string">z</span><span class="string">&#39;</span>) {
letterCount[arrayIndex]++;
}
}
} <span class="literal">catch</span> (FileNotFoundException ex) {
System.<span class="ST2">out</span>.println(ex);
}
<span class="comment">//Alright. We should have an array with a count of every char in the file.</span>
<span class="literal">for</span> (<span class="literal">int</span> i = <span class="number">0</span>; i &lt; letterCount.<span class="ST3">length</span>; ++i) {
<span class="literal">if</span> (letterCount[i] &gt; <span class="number">0</span>) {
System.<span class="ST2">out</span>.println(<span class="string">&quot;</span><span class="string">Number of </span><span class="string">&quot;</span> + Character.<span class="ST4">toUpperCase</span>((<span class="literal">char</span>) (i + <span class="number">97</span>)) + <span class="string">&quot;</span><span class="string">&#39;s: </span><span class="string">&quot;</span> + letterCount[i]);
}
}
}
}
</pre></body>
</html>

@ -0,0 +1,90 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>removeAllOccurances.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}
.literal {color: #cc7832}
.ST3 {font-family: monospace; font-weight: bold; font-style: italic}
.ST0 {color: #287bde}
.string {color: #6a8759}
.number {color: #6897bb}
.ST4 {color: #9876aa}
.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}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Semester 2/Assignments/lab7_CalebFontenot/src/main/java/com/calebfontenot/lab7_calebfontenot/removeAllOccurances.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.lab7_calebfontenot;
<span class="literal">import</span> java.io.BufferedReader;
<span class="literal">import</span> java.io.File;
<span class="literal">import</span> java.io.FileNotFoundException;
<span class="literal">import</span> java.io.FileReader;
<span class="literal">import</span> java.io.IOException;
<span class="literal">import</span> java.io.PrintWriter;
<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> removeAllOccurances {
<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">throws</span> FileNotFoundException, IOException {
Scanner input = <span class="literal">new</span> Scanner(System.<span class="ST2">in</span>);
System.<span class="ST2">out</span>.print(<span class="string">&quot;</span><span class="string">Enter a path to a file: </span><span class="string">&quot;</span>);
String sourcePath = input.nextLine();
System.<span class="ST2">out</span>.print(<span class="string">&quot;</span><span class="string">Replace what with what? (ex. If you want to replace John with Mary, type: </span><span class="literal">\&#39;</span><span class="string">John Mary</span><span class="literal">\&#39;</span><span class="string">): </span><span class="string">&quot;</span>);
String source = input.next();
String target = input.next();
input.nextLine(); <span class="comment">// Consume newline left-over</span>
System.<span class="ST2">out</span>.print(<span class="string">&quot;</span><span class="string">Enter the output file path: </span><span class="string">&quot;</span>);
String destinationPath = input.nextLine();
File sourceFile = <span class="literal">new</span> File(sourcePath);
File destinationFile = <span class="literal">new</span> File(destinationPath);
String[] fileContents = <span class="literal">new</span> String[(<span class="literal">int</span>) <span class="ST3">countLines</span>(sourceFile)];
<span class="literal">try</span> (Scanner sourceScanner = <span class="literal">new</span> Scanner(sourceFile)) {
<span class="literal">for</span> (<span class="literal">int</span> i = <span class="number">0</span>; i &lt; <span class="ST3">countLines</span>(sourceFile); ++i) {
fileContents[i] = sourceScanner.nextLine();
}
}
<span class="literal">for</span> (<span class="literal">int</span> i = <span class="number">0</span>; i &lt; fileContents.<span class="ST4">length</span>; ++i) {
fileContents[i] = fileContents[i].replace(source, target);
System.<span class="ST2">out</span>.println(fileContents[i]);
}
<span class="comment">// Write contents to new file</span>
<span class="literal">try</span> (PrintWriter fw = <span class="literal">new</span> PrintWriter(destinationFile);) {
<span class="literal">for</span> (<span class="literal">int</span> i = <span class="number">0</span>; i &lt; fileContents.<span class="ST4">length</span>; ++i) {
fw.println(fileContents[i]);
}
}
}
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">int</span> <span class="ST1">countLines</span>(File sourceFile) <span class="literal">throws</span> IOException {
BufferedReader reader = <span class="literal">new</span> BufferedReader(<span class="literal">new</span> FileReader(sourceFile));
<span class="literal">int</span> lines = <span class="number">0</span>;
<span class="literal">while</span> (reader.readLine() != <span class="literal">null</span>) {
lines++;
}
reader.close();
<span class="literal">return</span> lines;
}
}
</pre></body>
</html>

@ -0,0 +1,46 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package com.calebfontenot.lab7_calebfontenot;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
/**
*
* @author caleb
*/
public class occurrencesOfEachCharacter {
public static void main(String[] args) {
System.out.println((int) 'a' + ", " + (int) 'z');
// Number array for each letter in alphabet
int[] letterCount = new int[26];
Scanner input = new Scanner(System.in);
System.out.print("Enter a path to a file to scan: ");
File filePath = new File(input.nextLine());
try (Scanner fileScanner = new Scanner(filePath);) {
char currentChar;
int arrayIndex = 0;
//Instruct scanner to delimit at everything
fileScanner.useDelimiter("");
while (fileScanner.hasNext()) {
currentChar = fileScanner.next().toLowerCase().charAt(0);
arrayIndex = ((int) currentChar - 97); //This will determine where in the array to increment at
//System.out.println(currentChar);
if (currentChar > 'a' & currentChar < 'z') {
letterCount[arrayIndex]++;
}
}
} catch (FileNotFoundException ex) {
System.out.println(ex);
}
//Alright. We should have an array with a count of every char in the file.
for (int i = 0; i < letterCount.length; ++i) {
if (letterCount[i] > 0) {
System.out.println("Number of " + Character.toUpperCase((char) (i + 97)) + "'s: " + letterCount[i]);
}
}
}
}

@ -4,8 +4,12 @@
*/
package com.calebfontenot.lab7_calebfontenot;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;
/**
@ -13,27 +17,45 @@ import java.util.Scanner;
* @author caleb
*/
public class removeAllOccurances {
public static void main(String[] args) throws FileNotFoundException
{
public static void main(String[] args) throws FileNotFoundException, IOException {
Scanner input = new Scanner(System.in);
System.out.print("Enter a path to a file: ");
String sourcePath = input.nextLine();
System.out.print("Replace what with what? (ex. If you want to replace John with Mary, type: \'John Mary\'): ");
String source = input.next();
String target = input.next();
input.nextLine(); // Consume newline left-over
System.out.print("Enter the output file path: ");
String destinationPath = input.nextLine();
File sourceFile = new File(sourcePath);
File destinationFile = new File(destinationPath);
String[] fileContents = new String[(int) sourceFile.length()];
String[] fileContents = new String[(int) countLines(sourceFile)];
try (Scanner sourceScanner = new Scanner(sourceFile)) {
for (int i = 0; i < sourceFile.length(); ++i) {
for (int i = 0; i < countLines(sourceFile); ++i) {
fileContents[i] = sourceScanner.nextLine();
}
}
for (int i = 0; i < fileContents.length; ++i) {
fileContents[i] = fileContents[i].replace(source, target);
System.out.println(fileContents[i]);
}
// Write contents to new file
try (PrintWriter fw = new PrintWriter(destinationFile);) {
for (int i = 0; i < fileContents.length; ++i) {
fw.println(fileContents[i]);
}
}
}
public static int countLines(File sourceFile) throws IOException {
BufferedReader reader = new BufferedReader(new FileReader(sourceFile));
int lines = 0;
while (reader.readLine() != null) {
lines++;
}
reader.close();
return lines;
}
}

@ -0,0 +1,38 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>European.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}
.literal {color: #cc7832}
.ST0 {color: #287bde}
.ST1 {color: #ffc66d}
.comment {color: #808080}
.whitespace {color: #505050}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Semester 2/Assignments/lab8_2_CalebFontenot/src/main/java/com/calebfontenot/lab8_2_calebfontenot/interfacesGrouped/fun/European.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/Interface.java</span><span class="comment"> to edit this template</span>
<span class="comment"> */</span>
<span class="literal">package</span> com.calebfontenot.lab8_2_calebfontenot.interfacesGrouped.fun;
<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">interface</span> European <span class="literal">extends</span> Language, Religion, War {
<span class="literal">void</span> <span class="ST1">whatCountry</span>();
}
</pre></body>
</html>

@ -0,0 +1,67 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>French.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}
.literal {color: #cc7832}
.ST0 {color: #287bde}
.string {color: #6a8759}
.ST1 {color: #ffc66d}
.comment {color: #808080}
.whitespace {color: #505050}
.ST2 {color: #9876aa; font-family: monospace; font-weight: bold; font-style: italic}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Semester 2/Assignments/lab8_2_CalebFontenot/src/main/java/com/calebfontenot/lab8_2_calebfontenot/interfacesGrouped/fun/French.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/Interface.java</span><span class="comment"> to edit this template</span>
<span class="comment"> */</span>
<span class="literal">package</span> com.calebfontenot.lab8_2_calebfontenot.interfacesGrouped.fun;
<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> French <span class="literal">implements</span> European
{
@Override
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">whatCountry</span>() {
System.<span class="ST2">out</span>.println(<span class="string">&quot;</span><span class="string">+++ I am from France! +++</span><span class="string">&quot;</span>);
}
@Override
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">speakLanguage</span>()
{
System.<span class="ST2">out</span>.println(<span class="string">&quot;</span><span class="string">speak French</span><span class="string">&quot;</span>);
}
@Override
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">practiceReligion</span>()
{
System.<span class="ST2">out</span>.println(<span class="string">&quot;</span><span class="string">Roman Catholic</span><span class="string">&quot;</span>);
}
@Override
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">WWI</span>()
{
System.<span class="ST2">out</span>.println(<span class="string">&quot;</span><span class="string">In WW1 the French won -- Allies!</span><span class="string">&quot;</span>);
}
@Override
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">WWII</span>()
{
System.<span class="ST2">out</span>.println(<span class="string">&quot;</span><span class="string">In WW2 the French wan -- Allies!</span><span class="string">&quot;</span>);
}
}
</pre></body>
</html>

@ -0,0 +1,69 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>German.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}
.literal {color: #cc7832}
.ST0 {color: #287bde}
.string {color: #6a8759}
.ST1 {color: #ffc66d}
.comment {color: #808080}
.whitespace {color: #505050}
.ST2 {color: #9876aa; font-family: monospace; font-weight: bold; font-style: italic}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Semester 2/Assignments/lab8_2_CalebFontenot/src/main/java/com/calebfontenot/lab8_2_calebfontenot/interfacesGrouped/fun/German.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.lab8_2_calebfontenot.interfacesGrouped.fun;
<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> German <span class="literal">implements</span> European {
@Override
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">whatCountry</span>()
{
System.<span class="ST2">out</span>.println(<span class="string">&quot;</span><span class="string">+++ I am from Germany! +++</span><span class="string">&quot;</span>);
}
@Override
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">speakLanguage</span>()
{
System.<span class="ST2">out</span>.println(<span class="string">&quot;</span><span class="string">speak German</span><span class="string">&quot;</span>);
}
@Override
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">practiceReligion</span>()
{
System.<span class="ST2">out</span>.println(<span class="string">&quot;</span><span class="string">Protestant</span><span class="string">&quot;</span>);
}
@Override
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">WWI</span>()
{
System.<span class="ST2">out</span>.println(<span class="string">&quot;</span><span class="string">in WW1 the Germans lost -- Axis!</span><span class="string">&quot;</span>);
}
@Override
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">WWII</span>()
{
System.<span class="ST2">out</span>.println(<span class="string">&quot;</span><span class="string">in WW2 the Germans lost -- Axis!</span><span class="string">&quot;</span>);
}
}
</pre></body>
</html>

@ -0,0 +1,35 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Interface1.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}
.literal {color: #cc7832}
.comment {color: #808080}
.whitespace {color: #505050}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Semester 2/Assignments/lab8_2_CalebFontenot/src/main/java/com/calebfontenot/lab8_2_calebfontenot/interfacesGrouped/Interface1.java</td></tr></table>
<pre>
<span class="comment">/*</span>
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license</span>
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template</span>
<span class="comment"> */</span>
<span class="literal">package</span> com.calebfontenot.lab8_2_calebfontenot.interfacesGrouped;
<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">interface</span> Interface1 {
<span class="literal">abstract</span> <span class="literal">void</span> I1();
}
</pre></body>
</html>

@ -0,0 +1,35 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Interface2.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}
.literal {color: #cc7832}
.comment {color: #808080}
.whitespace {color: #505050}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Semester 2/Assignments/lab8_2_CalebFontenot/src/main/java/com/calebfontenot/lab8_2_calebfontenot/interfacesGrouped/Interface2.java</td></tr></table>
<pre>
<span class="comment">/*</span>
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license</span>
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template</span>
<span class="comment"> */</span>
<span class="literal">package</span> com.calebfontenot.lab8_2_calebfontenot.interfacesGrouped;
<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">interface</span> Interface2 {
<span class="literal">abstract</span> <span class="literal">void</span> I2();
}
</pre></body>
</html>

@ -0,0 +1,47 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>InterfaceGrouped1.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}
.literal {color: #cc7832}
.number {color: #6897bb}
.string {color: #6a8759}
.comment {color: #808080}
.whitespace {color: #505050}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Semester 2/Assignments/lab8_2_CalebFontenot/src/main/java/com/calebfontenot/lab8_2_calebfontenot/interfacesGrouped/InterfaceGrouped1.java</td></tr></table>
<pre>
<span class="comment">/*</span>
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license</span>
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template</span>
<span class="comment"> */</span>
<span class="literal">package</span> com.calebfontenot.lab8_2_calebfontenot.interfacesGrouped;
<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">interface</span> InterfaceGrouped1 <span class="literal">extends</span> Interface1, Interface2 {
<span class="literal">int</span> x = <span class="number">10</span>; <span class="comment">//public static shared by all who implement or extend the interface</span>
<span class="literal">abstract</span> <span class="literal">void</span> IG1();
<span class="literal">static</span> <span class="literal">void</span> staticMethodOfInterface() {
System.out.println(<span class="string">&quot;</span><span class="string">A static method inside an Interface is shared by every class</span><span class="string">&quot;</span> +
<span class="string">&quot;</span><span class="string"> that implements Interface InterfaceGrouped1.</span><span class="string">&quot;</span>);
}
<span class="literal">default</span> <span class="literal">void</span> defaultMethodOfInterface() {
System.out.println(<span class="string">&quot;</span><span class="string">The default implementation was used as there was no overriding</span><span class="string">&quot;</span> +
<span class="string">&quot;</span><span class="string"> by a class that was implemented the Interface InterfaceGrouped1.</span><span class="string">&quot;</span>);
}
}
</pre></body>
</html>

@ -0,0 +1,69 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Italian.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}
.literal {color: #cc7832}
.ST0 {color: #287bde}
.string {color: #6a8759}
.ST1 {color: #ffc66d}
.comment {color: #808080}
.whitespace {color: #505050}
.ST2 {color: #9876aa; font-family: monospace; font-weight: bold; font-style: italic}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Semester 2/Assignments/lab8_2_CalebFontenot/src/main/java/com/calebfontenot/lab8_2_calebfontenot/interfacesGrouped/fun/Italian.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.lab8_2_calebfontenot.interfacesGrouped.fun;
<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> Italian <span class="literal">implements</span> European {
@Override
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">whatCountry</span>()
{
System.<span class="ST2">out</span>.println(<span class="string">&quot;</span><span class="string">+++ I am from Itally! +++</span><span class="string">&quot;</span>);
}
@Override
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">speakLanguage</span>()
{
System.<span class="ST2">out</span>.println(<span class="string">&quot;</span><span class="string">speak Italian</span><span class="string">&quot;</span>);
}
@Override
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">practiceReligion</span>()
{
System.<span class="ST2">out</span>.println(<span class="string">&quot;</span><span class="string">Roman Catholic</span><span class="string">&quot;</span>);
}
@Override
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">WWI</span>()
{
System.<span class="ST2">out</span>.println(<span class="string">&quot;</span><span class="string">in WW1 the Italians won -- Allies!</span><span class="string">&quot;</span>);
}
@Override
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">WWII</span>()
{
System.<span class="ST2">out</span>.println(<span class="string">&quot;</span><span class="string">In WW2 the Italians lost -- Axis!</span><span class="string">&quot;</span>);
}
}
</pre></body>
</html>

@ -0,0 +1,35 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Language.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}
.literal {color: #cc7832}
.comment {color: #808080}
.whitespace {color: #505050}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Semester 2/Assignments/lab8_2_CalebFontenot/src/main/java/com/calebfontenot/lab8_2_calebfontenot/interfacesGrouped/fun/Language.java</td></tr></table>
<pre>
<span class="comment">/*</span>
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license</span>
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template</span>
<span class="comment"> */</span>
<span class="literal">package</span> com.calebfontenot.lab8_2_calebfontenot.interfacesGrouped.fun;
<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">interface</span> Language {
<span class="literal">void</span> speakLanguage();
}
</pre></body>
</html>

@ -0,0 +1,42 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Religion.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}
.literal {color: #cc7832}
.ST0 {color: #287bde}
.string {color: #6a8759}
.ST1 {color: #ffc66d}
.comment {color: #808080}
.whitespace {color: #505050}
.ST2 {color: #9876aa; font-family: monospace; font-weight: bold; font-style: italic}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Semester 2/Assignments/lab8_2_CalebFontenot/src/main/java/com/calebfontenot/lab8_2_calebfontenot/interfacesGrouped/fun/Religion.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/Interface.java</span><span class="comment"> to edit this template</span>
<span class="comment"> */</span>
<span class="literal">package</span> com.calebfontenot.lab8_2_calebfontenot.interfacesGrouped.fun;
<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">interface</span> Religion {
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">practiceReligion</span>();
<span class="literal">default</span> <span class="literal">void</span> <span class="ST1">beforeChrist</span>() {
System.<span class="ST2">out</span>.println(<span class="string">&quot;</span><span class="string">paganism</span><span class="string">&quot;</span>);
}
}
</pre></body>
</html>

@ -0,0 +1,69 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Russian.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}
.literal {color: #cc7832}
.ST0 {color: #287bde}
.string {color: #6a8759}
.ST1 {color: #ffc66d}
.comment {color: #808080}
.whitespace {color: #505050}
.ST2 {color: #9876aa; font-family: monospace; font-weight: bold; font-style: italic}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Semester 2/Assignments/lab8_2_CalebFontenot/src/main/java/com/calebfontenot/lab8_2_calebfontenot/interfacesGrouped/fun/Russian.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.lab8_2_calebfontenot.interfacesGrouped.fun;
<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> Russian <span class="literal">implements</span> European {
@Override
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">whatCountry</span>()
{
System.<span class="ST2">out</span>.println(<span class="string">&quot;</span><span class="string">+++ I am from Russia! +++</span><span class="string">&quot;</span>);
}
@Override
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">speakLanguage</span>()
{
System.<span class="ST2">out</span>.println(<span class="string">&quot;</span><span class="string">speak Russian</span><span class="string">&quot;</span>);
}
@Override
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">practiceReligion</span>()
{
System.<span class="ST2">out</span>.println(<span class="string">&quot;</span><span class="string">Orthodox</span><span class="string">&quot;</span>);
}
@Override
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">WWI</span>()
{
System.<span class="ST2">out</span>.println(<span class="string">&quot;</span><span class="string">In WW1 the Russians won -- Allies!</span><span class="string">&quot;</span>);
}
@Override
<span class="literal">public</span> <span class="literal">void</span> <span class="ST1">WWII</span>()
{
System.<span class="ST2">out</span>.println(<span class="string">&quot;</span><span class="string">In WW2 the Russians won -- Allies!</span><span class="string">&quot;</span>);
}
}
</pre></body>
</html>

@ -0,0 +1,101 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>TestEuropeans.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}
.literal {color: #cc7832}
.ST2 {font-family: monospace; font-weight: bold; font-style: italic}
.ST0 {color: #287bde}
.number {color: #6897bb}
.string {color: #6a8759}
.comment {color: #808080}
.whitespace {color: #505050}
.ST1 {color: #ffc66d; font-family: monospace; font-weight: bold; font-style: italic}
.ST3 {color: #9876aa; font-family: monospace; font-weight: bold; font-style: italic}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Semester 2/Assignments/lab8_2_CalebFontenot/src/main/java/com/calebfontenot/lab8_2_calebfontenot/interfacesGrouped/fun/TestEuropeans.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.lab8_2_calebfontenot.interfacesGrouped.fun;
<span class="literal">import</span> java.util.ArrayList;
<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> TestEuropeans {
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST1">testWithArrayList</span>() {
ArrayList&lt;European&gt; europeans = <span class="literal">new</span> ArrayList();
europeans.add(<span class="literal">new</span> French());
europeans.add(<span class="literal">new</span> German());
europeans.add(<span class="literal">new</span> Russian());
europeans.add(<span class="literal">new</span> Italian());
<span class="literal">for</span> (European man : europeans) {
man.whatCountry();
man.beforeChrist();
man.practiceReligion();
man.speakLanguage();
man.WWI();
man.WWII();
}
}
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST1">testWithArrayOfObjects</span>() {
European[] europeans = {
<span class="literal">new</span> French(),
<span class="literal">new</span> German(),
<span class="literal">new</span> Russian(),
<span class="literal">new</span> Italian()
};
<span class="literal">for</span> (European person : europeans) {
person.whatCountry();
person.beforeChrist();
person.practiceReligion();
person.speakLanguage();
person.WWI();
person.WWII();
}
}
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST1">testWithArrayOfInterfaces</span>() {
European[] europeans = <span class="literal">new</span> European[<span class="number">4</span>];
europeans[<span class="number">0</span>] = <span class="literal">new</span> French();
europeans[<span class="number">1</span>] = <span class="literal">new</span> German();
europeans[<span class="number">2</span>] = <span class="literal">new</span> Russian();
europeans[<span class="number">3</span>] = <span class="literal">new</span> Italian();
<span class="literal">for</span> (European person : europeans) {
person.whatCountry();
person.beforeChrist();
person.practiceReligion();
person.speakLanguage();
person.WWI();
person.WWII();
}
}
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST1">main</span>(String[] args) {
<span class="ST2">testWithArrayList</span>();
System.<span class="ST3">out</span>.println(<span class="string">&quot;</span><span class="string">-------------------</span><span class="string">&quot;</span>);
<span class="ST2">testWithArrayOfObjects</span>();
System.<span class="ST3">out</span>.println(<span class="string">&quot;</span><span class="string">-------------------</span><span class="string">&quot;</span>);
<span class="ST2">testWithArrayOfInterfaces</span>();
}
}
</pre></body>
</html>

@ -0,0 +1,57 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>TestEuropeansAgain.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}
.literal {color: #cc7832}
.ST2 {font-family: monospace; font-weight: bold; font-style: italic}
.ST0 {color: #287bde}
.number {color: #6897bb}
.comment {color: #808080}
.whitespace {color: #505050}
.ST1 {color: #ffc66d; font-family: monospace; font-weight: bold; font-style: italic}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Semester 2/Assignments/lab8_2_CalebFontenot/src/main/java/com/calebfontenot/lab8_2_calebfontenot/interfacesGrouped/fun/TestEuropeansAgain.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.lab8_2_calebfontenot.interfacesGrouped.fun;
<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> TestEuropeansAgain {
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST1">testWithArrayOfInterfaces</span>() {
European[] europeans = <span class="literal">new</span> European[<span class="number">4</span>];
europeans[<span class="number">0</span>] = <span class="literal">new</span> French();
europeans[<span class="number">1</span>] = <span class="literal">new</span> German();
europeans[<span class="number">2</span>] = <span class="literal">new</span> Russian();
europeans[<span class="number">3</span>] = <span class="literal">new</span> Italian();
<span class="literal">for</span> (European person : europeans) {
person.whatCountry();
person.beforeChrist();
person.practiceReligion();
person.speakLanguage();
person.WWI();
person.WWII();
}
}
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST1">main</span>(String[] args) {
<span class="ST2">testWithArrayOfInterfaces</span>();
}
}
</pre></body>
</html>

@ -0,0 +1,62 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>TestInterfaces.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}
.literal {color: #cc7832}
.string {color: #6a8759}
.comment {color: #808080}
.whitespace {color: #505050}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Semester 2/Assignments/lab8_2_CalebFontenot/src/main/java/com/calebfontenot/lab8_2_calebfontenot/interfacesGrouped/TestInterfaces.java</td></tr></table>
<pre>
<span class="comment">/*</span>
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license</span>
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template</span>
<span class="comment"> */</span>
<span class="literal">package</span> com.calebfontenot.lab8_2_calebfontenot.interfacesGrouped;
<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> TestInterfaces <span class="literal">implements</span> InterfaceGrouped1 {
@Override
<span class="literal">public</span> <span class="literal">void</span> IG1() {
System.out.println(<span class="string">&quot;</span><span class="string">TestInterfaces:IG1()</span><span class="string">&quot;</span>);
}
@Override
<span class="literal">public</span> <span class="literal">void</span> I1() {
System.out.println(<span class="string">&quot;</span><span class="string">TestInterfaces:I1()</span><span class="string">&quot;</span>);
}
@Override
<span class="literal">public</span> <span class="literal">void</span> I2() {
System.out.println(<span class="string">&quot;</span><span class="string">testInterfaces:I2()</span><span class="string">&quot;</span>);
}
@Override
<span class="literal">public</span> <span class="literal">void</span> defaultMethodOfInterface() {
System.out.println(<span class="string">&quot;</span><span class="string">overriden implementation of defaultMethodOfInterface</span><span class="string">&quot;</span>);
}
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> main(String[] args)
{
System.out.println(TestInterfaces.x);
InterfaceGrouped1.staticMethodOfInterface();
TestInterfaces ti = <span class="literal">new</span> TestInterfaces();
ti.I1();
ti.I2();
ti.IG1();
ti.defaultMethodOfInterface();
}
}
</pre></body>
</html>

@ -0,0 +1,38 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>War.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}
.literal {color: #cc7832}
.ST0 {color: #287bde}
.ST1 {color: #ffc66d}
.comment {color: #808080}
.whitespace {color: #505050}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Semester 2/Assignments/lab8_2_CalebFontenot/src/main/java/com/calebfontenot/lab8_2_calebfontenot/interfacesGrouped/fun/War.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/Interface.java</span><span class="comment"> to edit this template</span>
<span class="comment"> */</span>
<span class="literal">package</span> com.calebfontenot.lab8_2_calebfontenot.interfacesGrouped.fun;
<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">interface</span> War {
<span class="literal">void</span> <span class="ST1">WWI</span>();
<span class="literal">void</span> <span class="ST1">WWII</span>();
}
</pre></body>
</html>

@ -25,7 +25,7 @@ public class Italian implements European {
@Override
public void practiceReligion()
{
System.out.println("paganism");
System.out.println("Roman Catholic");
}
@Override

@ -12,8 +12,7 @@ import java.util.ArrayList;
*/
public class TestEuropeans {
public static void testWithArrayList()
{
public static void testWithArrayList() {
ArrayList<European> europeans = new ArrayList();
europeans.add(new French());
@ -21,7 +20,7 @@ public class TestEuropeans {
europeans.add(new Russian());
europeans.add(new Italian());
for(European man: europeans) {
for (European man : europeans) {
man.whatCountry();
man.beforeChrist();
man.practiceReligion();
@ -30,14 +29,15 @@ public class TestEuropeans {
man.WWII();
}
}
public static void testWithArrayOfObjects() {
European[] europeans = {
new French(),
new German(),
new Russian(),
new Italian()
};
for (European person: europeans) {
new French(),
new German(),
new Russian(),
new Italian()
};
for (European person : europeans) {
person.whatCountry();
person.beforeChrist();
person.practiceReligion();
@ -46,15 +46,28 @@ public class TestEuropeans {
person.WWII();
}
}
public static void testWithArrayOfInterfaces() {
Interface[] interfaceArr = {
European[] europeans = new European[4];
europeans[0] = new French();
europeans[1] = new German();
europeans[2] = new Russian();
europeans[3] = new Italian();
for (European person : europeans) {
person.whatCountry();
person.beforeChrist();
person.practiceReligion();
person.speakLanguage();
person.WWI();
person.WWII();
}
}
public static void main(String[] args)
{
public static void main(String[] args) {
testWithArrayList();
System.out.println("-------------------");
testWithArrayOfObjects();
System.out.println("-------------------");
testWithArrayOfInterfaces();
}
}

@ -0,0 +1,31 @@
/*
* 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.lab8_2_calebfontenot.interfacesGrouped.fun;
/**
*
* @author caleb
*/
public class TestEuropeansAgain {
public static void testWithArrayOfInterfaces() {
European[] europeans = new European[4];
europeans[0] = new French();
europeans[1] = new German();
europeans[2] = new Russian();
europeans[3] = new Italian();
for (European person : europeans) {
person.whatCountry();
person.beforeChrist();
person.practiceReligion();
person.speakLanguage();
person.WWI();
person.WWII();
}
}
public static void main(String[] args) {
testWithArrayOfInterfaces();
}
}

@ -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.calebfontenot.testproject;
/**
*
* @author caleb
*/
public class ExceptionTesting {
public static void main(String[] args) {
Object nullMoment = null;
System.out.println(nullMoment);
}
}

@ -21,18 +21,21 @@ public class StringBuilderTest2 {
String s1 = "Welcome to Java";
String s2 = "Welcome to Java";
System.out.println("s1 == s2 is " + (s1 == s2));
}
}
//System.out.println("s1 == s2 is " + (s1 == s2));
/*
Circle[] circleArray = new Circle[5];
circleArray[0] = "test";
//circleArray[0] = "test";
for (Circle object: circleArray) {
System.out.println(object);
}
}
}
/*
public class Circle {
Circle() {
}
}
}
*/