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,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();
}
}