Reset author name to chosen name

This commit is contained in:
2025-10-19 22:02:41 -05:00
parent 168b35c94a
commit 578c33de70
316 changed files with 17381 additions and 0 deletions

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.chloefontenot.exam1_chloefontenot;
/**
*
* @author ar114
*/
public class Exam1_ChloeFontenot {
public static void main(String[] args) {
System.out.println("Hello World!".toUpperCase());
}
}

View File

@@ -0,0 +1,54 @@
/*
* 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.chloefontenot.exam1_chloefontenot;
/**
*
* @author ar114
*/
public class Location {
public static int row;
public static int column;
public static double maxValue;
int x, y;
Location(int x, int y) {
this.x = x;
this.y = y;
}
public static Location locateLargest(double[][] arr) {
maxValue = arr[0][0];
//Find max value
for (int i = 0; i < arr.length - 1; ++i) {
for (int j = 0; j < arr[i].length; ++j) {
if (maxValue < arr[i][j]) {
maxValue = arr[i][j];
column = i;
row = j;
}
}
}
return new Location(column, row);
}
@Override
public String toString() {
String s = "The location of the largest element is ";
s += maxValue + " at (" + this.x + ", "+ this.y +")";
return s;
}
public static void main(String[] args) {
double[][] arr = {
{23.5, 35, 2, 10, 12},
{4.5, 3, 45},
{35, 44, 5.5, 9.6}
};
System.out.println(locateLargest(arr));
}
}

View File

@@ -0,0 +1,123 @@
/*
* 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.chloefontenot.exam1_chloefontenot;
import java.util.Arrays;
/**
*
* @author chloe
*/
public class MyStringBuilder {
//private int size = 0; // Size is not necessary. Remove it and modify the code.
//private int capacity = 0; //not necessary
private char[] buffer;
public MyStringBuilder() {
}
public MyStringBuilder(char[] chars) {
buffer = chars;
}
public MyStringBuilder(String s) {
buffer = s.toCharArray();
}
private void increaseCapacity(int newCapacity) {
char[] temp = new char[newCapacity];
System.arraycopy(buffer, 0, temp, 0, buffer.length);
buffer = temp;
}
public MyStringBuilder append(MyStringBuilder s) {
int oldLength = buffer.length;
char[] toAdd = s.buffer;
increaseCapacity(toAdd.length + oldLength);
int j = 0;
for (int i = oldLength; i < (oldLength + s.buffer.length); ++i) {
buffer[i] = toAdd[j++];
}
return this;
}
/**
* public MyStringBuilder append(int i) {
*
* }
*
* @return
*
*/
public int length() {
return buffer.length -1;
}
public char charAt(int index) {
return buffer[index];
}
public MyStringBuilder toLowerCase() {
for (int i = 0; i < buffer.length; ++i) {
buffer[i] = Character.toLowerCase(buffer[i]);
}
return this;
}
public MyStringBuilder substring(int begin, int end) {
String s = "";
for (int i = begin; i < end; ++i) {
s += buffer[i];
}
return new MyStringBuilder(s.toCharArray());
}
@Override
public String toString() {
String s = "";
for(char c: buffer)
{
s += c;
}
return s;
}
public MyStringBuilder reverse() {
char[] reversed = new char[buffer.length];
int j = 0;
for (int i = buffer.length - 1; i >= 0; --i) {
reversed[i] = buffer[j];
j++;
}
buffer = reversed;
return this;
}
public MyStringBuilder substring(int begin) {
return substring(begin, buffer.length);
}
public MyStringBuilder toUpperCase() {
for (int i = 0; i < buffer.length; ++i) {
buffer[i] = Character.toUpperCase(buffer[i]);
}
return this;
}
public static void main(String[] args) {
MyStringBuilder s1 = new MyStringBuilder("Welcome to");
MyStringBuilder s2 = new MyStringBuilder(" Java");
System.out.println(s1.length());
System.out.println(s1.charAt(3));
System.out.println(s1.toUpperCase().toString());
s1.append(s2);
System.out.println(s1.toString());
System.out.println(s1.substring(1, 4));
System.out.println(s1.reverse());
System.out.println(s1.reverse());
}
}

View File

@@ -0,0 +1,53 @@
/*
* 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.chloefontenot.exam1_chloefontenot;
/**
*
* @author ar114
*/
public class Question1 {
public static void sort(int[] arr) {
for (int i = 0; i < arr.length - 1; ++i) {
for (int j = i + 1; j < arr.length; ++j) {
if (arr[i] > arr[j]) {
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
}
}
}
public static void print(int[][][] arr) {
for (int i = 0; i < arr.length; ++i) {
for (int j = 0; j < arr[i].length; ++j) {
for (int k = 0; k < arr[i][j].length; ++k) {
System.out.print(arr[i][j][k] + " ");
}
System.out.println();
}
}
}
public static void main(String[] args) {
int[][][] arr = {
{
{11, 2, 6, 22}, {3, 90, 112, 40, 7, 12}
},
{
{10, -20, 3}, {300, 50}
}
};
for (int i = 0; i < arr.length; ++i) {
for (int j = 0; j < arr[i].length; ++j) {
sort(arr[i][j]);
}
}
print(arr);
}
}