-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ff783c0
Showing
583 changed files
with
9,750 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/Java SE 12.0.1 [12.0.1]"> | ||
<attributes> | ||
<attribute name="module" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>Book</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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=11 | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.release=enabled | ||
org.eclipse.jdt.core.compiler.source=11 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/Java SE 12.0.1 [12.0.1]"> | ||
<attributes> | ||
<attribute name="module" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>CarGarage</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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=11 | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.release=enabled | ||
org.eclipse.jdt.core.compiler.source=11 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
|
||
public class Car { | ||
|
||
private String make; | ||
private String model; | ||
private String color; | ||
private String licenseNumber; | ||
private int year; | ||
|
||
public Car(String make, String model, String color, String licenseNumber, int year) { | ||
this.make = make; | ||
this.model = model; | ||
this.color = color; | ||
this.licenseNumber = licenseNumber; | ||
this.year = year; | ||
} | ||
|
||
public Car(String make, String model, String color, int year) { | ||
this.make = make; | ||
this.model = model; | ||
this.color = color; | ||
this.year = year; | ||
} | ||
|
||
public String getMake() { | ||
return make; | ||
} | ||
|
||
public String getModel() { | ||
return model; | ||
} | ||
|
||
public String getColor() { | ||
return color; | ||
} | ||
|
||
public String getLicenseNumber() { | ||
return licenseNumber; | ||
} | ||
|
||
public int getYear() { | ||
return year; | ||
} | ||
|
||
public void setColor(String color) { | ||
this.color = color; | ||
} | ||
|
||
public void setLicenseNumber(String licenseNumber) { | ||
this.licenseNumber = licenseNumber; | ||
} | ||
|
||
public Car copy() { | ||
return new Car(make, model, color, licenseNumber, year); | ||
} | ||
|
||
public boolean equals(Object obj) { | ||
if(!(obj instanceof Car)) { | ||
return false; | ||
} | ||
Car other = (Car) obj; | ||
|
||
return make.equals(other.make) && model.equals(other.model) && color.equals(other.color) && licenseNumber.equals(other.licenseNumber) && year == other.year; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
|
||
public class Garage { | ||
|
||
private Car position1; | ||
private Car position2; | ||
|
||
public Garage() { | ||
position1 = null; | ||
position2 = null; | ||
} | ||
|
||
public boolean isParkingAreaTaken(int position) { | ||
return ((position == 1 && position1 != null) || (position == 2 && position2 != null)); | ||
} | ||
|
||
public void park(Car car, int position) { | ||
if(position == 1 && !isParkingAreaTaken(position)) { | ||
position1 = car; | ||
} else if (position == 2 && !isParkingAreaTaken(position)) { | ||
position2 = car; | ||
} | ||
} | ||
|
||
public Car leaveGarage(int position) { | ||
Car temp; | ||
|
||
if(position ==1) { | ||
temp = position1; | ||
position1 = null; | ||
return temp; | ||
} | ||
|
||
else if (position ==2) { | ||
temp = position2; | ||
position2 = null; | ||
return temp; | ||
} | ||
else { | ||
return null; | ||
} | ||
} | ||
|
||
public String toString() { | ||
String returnString = ""; | ||
|
||
if(position1 == null) { | ||
returnString ="Garage position 1 is empty"; | ||
} else { | ||
returnString = "Garage position 1 " + position1; | ||
} | ||
if(position2 == null) { | ||
returnString = "Garage position 2 is empty"; | ||
} else { | ||
returnString = "Garage position 2: " + position2; | ||
} | ||
} | ||
|
||
public boolean equals(Object obj) { | ||
if(!(obj instanceof Garage)) { | ||
return false; | ||
} | ||
|
||
Garage other = (Garage) obj; | ||
|
||
if(position1 != null && position2 != null) { | ||
return position1.equals(other.position1) && position2.equals(other.position2); | ||
} else if (position1 == null && position2 == null) { | ||
return other.position1 == null && other.position2 == null; | ||
} else if (position1 != null && position2 == null) { | ||
return position1.equals(other.position1) && other.position2 == null; | ||
} else if (position1 == null && position2 != null) { | ||
return other.position1 == null && position2.equals(other.position2); | ||
} else { | ||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
|
||
public class GarageArray { | ||
|
||
|
||
public class Garage { | ||
|
||
private Car[] cars; | ||
|
||
public Garage (int size) { | ||
cars = new Car[size]; | ||
} | ||
|
||
public Garage() { | ||
cars = new Car[1]; | ||
} | ||
|
||
public boolean isParkingAreaTaken(int position) { | ||
|
||
if(position < cars.length) { | ||
return cars[position] != null; | ||
} | ||
else { | ||
return false; | ||
} | ||
} | ||
|
||
public void park(Car car, int position) { | ||
if(position < cars.length) | ||
{ | ||
if(!isParkingAreaTaken(position)) { | ||
cars[position] = car; | ||
} | ||
} | ||
} | ||
|
||
public Car leaveGarage(int position) { | ||
Car temp = null; | ||
|
||
if(position < cars.length) { | ||
temp = cars[position]; | ||
cars[position]=null; | ||
} | ||
return temp; | ||
} | ||
|
||
public String toString() { | ||
|
||
String returnString =" "; | ||
|
||
for(int i=0; i<cars.length; i++) { | ||
if(cars[i] == null) { | ||
returnString += "Empty\n"; | ||
} else { | ||
returnString += cars[i] + "\n"; | ||
} | ||
} return returnString; | ||
} | ||
|
||
public boolean equals(Object obj) { | ||
if(!(obj instanceof Garage)) { | ||
return false; | ||
} | ||
|
||
Garage other = (Garage) obj; | ||
|
||
if(cars.length != other.cars.length) { | ||
return false; | ||
} | ||
else { | ||
for(int i =0; i< cars.length; i++) { | ||
if(cars[i] == null && other.cars[i] == null) { | ||
return false; | ||
} | ||
else if (cars[i] != null) { | ||
if(!(cars[i].equals(other.cars[i]))) { | ||
return false; | ||
} | ||
} | ||
} return true; | ||
} | ||
} | ||
|
||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/Java SE 12.0.1 [12.0.1]"> | ||
<attributes> | ||
<attribute name="module" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>Clock</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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=11 | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.release=enabled | ||
org.eclipse.jdt.core.compiler.source=11 |
Binary file not shown.
Binary file not shown.
Oops, something went wrong.