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