This commit is contained in:
ldy
2026-03-01 23:18:55 -05:00
commit 67f753a5d1
3087 changed files with 218259 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Question3</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,36 @@
public class Chicken {
//instance variables
private double weight;
private boolean sleeping;
//constructor
public Chicken(double weight) {
this.sleeping = true;
this.weight = weight;
}
//methods
public double getWeight() {return this.weight;}
public boolean isSleeping() {return this.sleeping;}
public void fallAsleep() {this.sleeping = true;}
public void wakeUp() {this.sleeping = false;}
//test
public static void testChicken() {
Chicken c = new Chicken(2.3);
System.out.println(c.getWeight() == 2.3);
System.out.println(c.isSleeping() == true);
c.wakeUp();
System.out.println(c.isSleeping() == false);
c.wakeUp(); // should do nothing because the chicken is already awake
System.out.println(c.isSleeping() == false);
c.fallAsleep();
System.out.println(c.isSleeping() == true);
c.fallAsleep(); // should do nothing because the chicken is already sleeping
System.out.println(c.isSleeping() == true);
}
}

View File

@@ -0,0 +1,8 @@
public class Start {
public static void main(String[] args) {
Chicken.testChicken();
}
}