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