Reset author name to chosen name

This commit is contained in:
2025-10-19 22:00:41 -05:00
parent 12cf757236
commit 168b35c94a
287 changed files with 0 additions and 17381 deletions

View File

@@ -1,17 +0,0 @@
/*
* 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

@@ -1,54 +0,0 @@
/*
* 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

@@ -1,123 +0,0 @@
/*
* 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

@@ -1,53 +0,0 @@
/*
* 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);
}
}

View File

@@ -1,76 +0,0 @@
/*
* 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.exam2.practice_chloefontenot;
import java.util.Objects;
/**
*
* @author chloe
*/
public class Automobile implements Comparable<Automobile> {
private String vin;
private CountryOfOrigin origin;
public Automobile(String vin, CountryOfOrigin origin)
{
this.vin = vin;
this.origin = origin;
}
public CountryOfOrigin getOrigin()
{
return origin;
}
public void setOrigin(CountryOfOrigin origin)
{
this.origin = origin;
}
public String getVin()
{
return vin;
}
public void setVin(String vin)
{
this.vin = vin;
}
@Override
public String toString()
{
return "Automobile{" + "vin=" + vin + ", origin=" + origin + '}';
}
@Override
public boolean equals(Object obj)
{
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Automobile other = (Automobile) obj;
if (!Objects.equals(this.vin, other.vin)) {
return false;
}
return Objects.equals(this.origin, other.origin);
}
@Override
public int compareTo(Automobile o)
{
return vin.compareTo(o.vin);
}
}

View File

@@ -1,102 +0,0 @@
/*
* 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.exam2.practice_chloefontenot;
import java.util.Arrays;
/**
*
* @author chloe
*/
public class CountryOfOrigin implements Cloneable, Comparable<CountryOfOrigin> {
private char[] country = "USA".toCharArray();
public CountryOfOrigin() {}
public CountryOfOrigin(char[] country)
{
this.country = country;
}
public String getCountry()
{
return String.copyValueOf(this.country);
}
public void setCountry(char[] country)
{
this.country = country;
}
public boolean changeOneLetter(int index, char newLetter)
{
if (index >= this.country.length || index < 0) {
return false;
}
this.country[index] = newLetter;
return true;
}
@Override
public boolean equals(Object obj)
{
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final CountryOfOrigin other = (CountryOfOrigin) obj;
return Arrays.equals(this.country, other.country);
}
@Override
public String toString()
{
return String.copyValueOf(this.country);
}
@Override
public int compareTo(CountryOfOrigin o)
{
return String.copyValueOf(this.country).compareTo(String.copyValueOf(o.country));
}
@Override
public Object clone() {
return new CountryOfOrigin(new String(this.country).toCharArray());
}
public static void main(String[] args) throws CloneNotSupportedException
{
CountryOfOrigin c1 = new CountryOfOrigin();
CountryOfOrigin c2 = new CountryOfOrigin("GERMANY".toCharArray());
CountryOfOrigin c3 = (CountryOfOrigin) c2.clone();
System.out.println("c1 is: " + c1);
System.out.println("c2 is: " + c2);
System.out.println("c3 cloned of c2 is: " + c3);
c3.changeOneLetter(0, 'J');
c3.changeOneLetter(1, 'A');
c3.changeOneLetter(2, 'P');
System.out.println("c3 after changeOneLetter is: " + c3);
System.out.println("if this displays GERMANY and not JAPMANY\nyour clone is deep: " + c2);
System.out.println(c1.compareTo(c2));
System.out.println(c1.compareTo(c3));
System.out.println(c1.equals(c2));
System.out.println(c1.equals(c3));
System.out.println(c2.getCountry());
c2.setCountry("ITALY".toCharArray());
System.out.println(c2.getCountry());
System.out.println(c1.getCountry());
}
}

View File

@@ -1,37 +0,0 @@
/*
* 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.exam2.practice_chloefontenot;
import java.util.ArrayList;
import java.util.Arrays;
/**
*
* @author chloe
*/
public class Dealership extends ArrayList<Automobile> {
/** Sorts the inherited ArrayList of Automobiles
* into ascending order by vin number.
* @param d the Dealership of Automobiles
*/
public static void sortByVin(Dealership d) { //java.util.Collections.sort() could do all of this in a single line
Object[] dealershipArray = d.toArray();
Arrays.sort(dealershipArray);
d.clear();
for (int i = 0; i < dealershipArray.length; ++i) {
d.add((Automobile) dealershipArray[i]);
}
}
public static void main(String[] args)
{
Dealership d = new Dealership();
d.add(new Automobile("8", new CountryOfOrigin("USA".toCharArray())));
d.add(new Automobile("1", new CountryOfOrigin("GERMANY".toCharArray())));
System.out.println("THE ORIGINAL DEALERSHIP\n" + d);
Dealership.sortByVin(d);
System.out.println("\nTHE SORTED BY VIN DEALERSHIP\n" + d);
}
}

View File

@@ -1,16 +0,0 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
*/
package com.chloefontenot.exam2.practice_chloefontenot;
/**
*
* @author chloe
*/
public class Exam2Practice_ChloeFontenot {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}

View File

@@ -1,94 +0,0 @@
/*
* 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.exam2.practice2_chloefontenot;
import java.util.Objects;
/**
*
* @author chloe
*/
public class Automobile extends Vehicle implements Cloneable{
private String make;
public Automobile(String make)
{
this.make = make;
}
public Automobile(String make, String vin)
{
super(vin);
this.make = make;
}
public String getMake() { return make; }
public void setMake(String make) { this.make = make; }
@Override
public int compareTo(Vehicle o)
{
return this.getVin().compareTo(o.getVin());
}
@Override
public boolean equals(Object obj)
{
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Automobile other = (Automobile) obj;
boolean isSameObjectType = Objects.equals(this.make, other.make);
if (isSameObjectType) {
if (this.make.compareTo(other.make) == 0 && (this.getVin().compareTo(other.getVin()) == 0)) {
return true;
} else {
return false;
}
} else {
return false;
}
}
@Override
protected Object clone() throws CloneNotSupportedException {
String make = new String(this.getMake());
String vim = new String(this.getVin());
Automobile clonedAuto = new Automobile(make, vim);
return clonedAuto;
}
@Override
public String toString()
{
return super.toString() + "\n" + "Automobile{" + "make=" + make + '}';
}
public static void main(String[] args) throws CloneNotSupportedException
{
Automobile johnsBeemer = new Automobile ("BMW", "vin1BMW");
Automobile marysBeemer = new Automobile ("BMW", "vin2BMW");
Automobile johnsClonedBeemer = (Automobile) johnsBeemer.clone();
System.out.println(johnsBeemer + "\n");
System.out.println(marysBeemer + "\n");
System.out.println(johnsClonedBeemer + "\n");
System.out.println("John\'s beemer EQUALS Mary\'s beemer --> " + johnsBeemer.equals(marysBeemer));
System.out.println("John\'s beemer EQUALS John\'s beemer --> " + johnsBeemer.equals(johnsClonedBeemer));
System.out.println("John\'s beemer COMPARE_TO John\'s cloned beemer --> " + johnsBeemer.compareTo(johnsClonedBeemer));
System.out.println("John\'s beemer COMPARE_TO Mary\'s beemer --> " +johnsBeemer.compareTo(marysBeemer));
System.out.println("John\'s beemer EQUALS Airplane --> " + johnsBeemer.equals(new Airplane()));
}
}
class Airplane {}

View File

@@ -1,16 +0,0 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
*/
package com.chloefontenot.exam2.practice2_chloefontenot;
/**
*
* @author chloe
*/
public class Exam2Practice2_ChloeFontenot {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}

View File

@@ -1,121 +0,0 @@
package com.chloefontenot.exam2.practice2_chloefontenot;
import java.util.Objects;
/**
*
* @author chloe
*/
public class Automobile extends Vehicle implements Cloneable{
private String make;
public Automobile(String make)
{
this.make = make;
}
public Automobile(String make, String vin)
{
super(vin);
this.make = make;
}
public String getMake() { return make; }
public void setMake(String make) { this.make = make; }
@Override
public int compareTo(Vehicle o)
{
return this.getVin().compareTo(o.getVin());
}
@Override
public boolean equals(Object obj)
{
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Automobile other = (Automobile) obj;
boolean isSameObjectType = Objects.equals(this.make, other.make);
if (isSameObjectType) {
if (this.make.compareTo(other.make) == 0 && (this.getVin().compareTo(other.getVin()) == 0)) {
return true;
} else {
return false;
}
} else {
return false;
}
}
@Override
protected Object clone() throws CloneNotSupportedException {
String make = new String(this.getMake());
String vim = new String(this.getVin());
Automobile clonedAuto = new Automobile(make, vim);
return clonedAuto;
}
@Override
public String toString()
{
return super.toString() + "\n" + "Automobile{" + "make=" + make + '}';
}
public static void main(String[] args) throws CloneNotSupportedException
{
Automobile johnsBeemer = new Automobile ("BMW", "vin1BMW");
Automobile marysBeemer = new Automobile ("BMW", "vin2BMW");
Automobile johnsClonedBeemer = (Automobile) johnsBeemer.clone();
System.out.println(johnsBeemer + "\n");
System.out.println(marysBeemer + "\n");
System.out.println(johnsClonedBeemer + "\n");
System.out.println("John\'s beemer EQUALS Mary\'s beemer --> " + johnsBeemer.equals(marysBeemer));
System.out.println("John\'s beemer EQUALS John\'s beemer --> " + johnsBeemer.equals(johnsClonedBeemer));
System.out.println("John\'s beemer COMPARE_TO John\'s cloned beemer --> " + johnsBeemer.compareTo(johnsClonedBeemer));
System.out.println("John\'s beemer COMPARE_TO Mary\'s beemer --> " +johnsBeemer.compareTo(marysBeemer));
System.out.println("John\'s beemer EQUALS Airplane --> " + johnsBeemer.equals(new Airplane()));
}
}
abstract public class Vehicle implements Cloneable, Comparable<Vehicle> {
private String vin;
public Vehicle(){}
public Vehicle(String vin) {this.vin = vin;}
public String getVin() { return vin; }
public void setVin(String vin) { this.vin = vin; }
@Override
public String toString()
{ return "Vehicle{" + "vin=" + vin + '}'; }
@Override
public boolean equals(Object obj)
{
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Vehicle other = (Vehicle) obj;
return Objects.equals(this.vin, other.vin);
}
}
class Airplane {}

View File

@@ -1,41 +0,0 @@
/*
* 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.exam2.practice2_chloefontenot;
import java.util.Objects;
/**
*
* @author chloe
*/
abstract public class Vehicle implements Cloneable, Comparable<Vehicle> {
private String vin;
public Vehicle(){}
public Vehicle(String vin) {this.vin = vin;}
public String getVin() { return vin; }
public void setVin(String vin) { this.vin = vin; }
@Override
public String toString()
{ return "Vehicle{" + "vin=" + vin + '}'; }
@Override
public boolean equals(Object obj)
{
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Vehicle other = (Vehicle) obj;
return Objects.equals(this.vin, other.vin);
}
}