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,13 +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.lab8_chloefontenot;
/**
*
* @author chloe
*/
public abstract class Animal {
public abstract String sound();
}

View File

@@ -1,18 +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.lab8_chloefontenot;
/**
*
* @author chloe
*/
public class Apple extends Fruit{
@Override
public String howToEat()
{
return "Apple: Make apple cider.";
}
}

View File

@@ -1,16 +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.lab8_chloefontenot;
/**
*
* @author chloe
*/
public class Brocoli extends Fruit {
@Override
public String howToEat() {
return "Brocolli: Steam it";
}
}

View File

@@ -1,20 +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.lab8_chloefontenot;
/**
*
* @author chloe
*/
public class Chicken extends Animal implements Edible {
@Override
public String sound() {
return "Chicken: cock-a-doodle-do!";
}
@Override
public String howToEat() {
return "Chicken: Fry it!";
}
}

View File

@@ -1,21 +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.lab8_chloefontenot;
/**
*
* @author chloe
*/
public class Duck extends Animal implements Edible {
@Override
public String howToEat() {
return "Duck: Roast it!";
}
@Override
public String sound() {
return "Duck: Quack! Quack! Quack!";
}
}

View File

@@ -1,13 +0,0 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
*/
package com.chloefontenot.lab8_chloefontenot;
/**
*
* @author chloe
*/
public interface Edible {
String howToEat();
}

View File

@@ -1,13 +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.lab8_chloefontenot;
/**
*
* @author chloe
*/
public abstract class Fruit implements Edible{
}

View File

@@ -1,133 +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.lab8_chloefontenot;
import java.util.Date;
/**
*
* @author chloe
*/
public class House implements Cloneable{
private int id;
private double area;
private Date whenBuilt;
public House(int id, double area)
{
this.id = id;
this.area = area;
this.whenBuilt = new Date();
}
@Override
protected Object clone() throws CloneNotSupportedException
{
Object o = super.clone();
((House) o).whenBuilt = new Date(this.whenBuilt.getTime());
return o;
}
/**
* Get the value of whenBuilt
*
* @return the value of whenBuilt
*/
public Date getWhenBuilt()
{
return whenBuilt;
}
/**
* Set the value of whenBuilt
*
* @param whenBuilt new value of whenBuilt
*/
public void setWhenBuilt(Date whenBuilt)
{
this.whenBuilt = whenBuilt;
}
/**
* Get the value of area
*
* @return the value of area
*/
public double getArea()
{
return area;
}
/**
* Set the value of area
*
* @param area new value of area
*/
public void setArea(double area)
{
this.area = area;
}
/**
* Get the value of id
*
* @return the value of id
*/
public int getId()
{
return id;
}
/**
* Set the value of id
*
* @param id new value of id
*/
public void setId(int id)
{
this.id = id;
}
@Override
public String toString()
{
return "House{" + "id=" + id + ", area=" + area + ", whenBuilt=" + whenBuilt + '}';
}
public int compareTo(House o) {
if (this.getId() == o.getId() &&
this.getArea() == o.getArea() &&
this.getWhenBuilt().equals(o.getWhenBuilt())) {
return 0;
}
if (this.area > o.area) {
return 1;
} else if (this.area < o.area) {
return -1;
} else {
return -2; // Same area for this and o but either var id or var whenBuilt are different
}
}
public static void main(String[] args) throws CloneNotSupportedException, InterruptedException {
House house1 = new House(1, 1000);
House house2 = (House) house1.clone();
house2.whenBuilt.setDate(8);
System.out.println(house1);
System.out.println(house2);
House house3 = new House(3, 2000);
House house4 = new House(4, 2000);
System.out.println("house 1 and house 2 are identical: "+ house1.compareTo(house2));
System.out.println("house 3 and house 3 have the same area: " + house3.compareTo(house4));
System.out.println("House 4 is harger than house 2: " + house4.compareTo(house2));
}
}

View File

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

View File

@@ -1,19 +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.lab8_chloefontenot;
import com.chloefontenot.lab8_chloefontenot.Fruit;
/**
*
* @author chloe
*/
public class Orange extends Fruit {
@Override
public String howToEat() {
return "Orange: Make orange juice.";
}
}

View File

@@ -1,36 +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.lab8_chloefontenot;
/**
*
* @author chloe
*/
public class Test {
Edible getEdible() {
Edible e = new Edible() {
@Override
public String howToEat() {
return "Beans: make a soup";
}
};
return e;
}
/*
Comparable getComparable() {
Comparable c = new Comparable() {
@Override
public int compareTo(Object o) {
return == "dummy value" ? ((o.hashCode() == 11 ? 1 : -1) : 0;
}
};
return c;
}
*/
public static void main(String[] args)
{
Edible[] edible = {new Chicken()};
}
}

View File

@@ -1,60 +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.lab8_chloefontenot;
import java.util.ArrayList;
/**
*
* @author chloe
*/
public class TestEdible {
public static void testWithArrayList() {
ArrayList<Edible> edible = new ArrayList();
edible.add(new Chicken());
edible.add(new Apple());
edible.add(new Orange());
edible.add(new Duck());
edible.add(new Brocoli());
for (Edible eat: edible) {
System.out.println(eat.howToEat());
}
}
public static void testWithArrayOfInterfaces() {
Edible[] edible = {
new Chicken(), new Apple(), new Orange(), new Duck(), new Brocoli()
};
for (int i = 0; i < edible.length; ++i) {
System.out.println(edible[i].howToEat());
}
}
public static void testWithArrayOfObjects() {
Object[] objects = {
new Tiger(), new Chicken(), new Apple(), new Duck(), new Brocoli()
};
for (int i = 0; i < objects.length; ++i) {
if (objects[i] instanceof Edible) {
System.out.println(((Edible) objects[i]).howToEat());
}
if (objects[i] instanceof Animal) {
System.out.println(((Animal) objects[i]).sound());
}
}
}
public static void main(String[] args)
{
testWithArrayOfObjects();
System.out.println("-------------------");
testWithArrayOfInterfaces();
System.out.println("------------------ ");
testWithArrayList();
}
}

View File

@@ -1,19 +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.lab8_chloefontenot;
/**
*
* @author chloe
*/
public class Tiger extends Animal {
@Override
public String sound()
{
return "Tiger: ROAAAAAAAR!";
}
}