Skip to content

Commit

Permalink
boom
Browse files Browse the repository at this point in the history
  • Loading branch information
florinbrd committed Nov 26, 2019
0 parents commit ff783c0
Show file tree
Hide file tree
Showing 583 changed files with 9,750 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
10 changes: 10 additions & 0 deletions Book/.classpath
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>
17 changes: 17 additions & 0 deletions Book/.project
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>
12 changes: 12 additions & 0 deletions Book/.settings/org.eclipse.jdt.core.prefs
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
10 changes: 10 additions & 0 deletions CarGarage/.classpath
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>
17 changes: 17 additions & 0 deletions CarGarage/.project
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>
12 changes: 12 additions & 0 deletions CarGarage/.settings/org.eclipse.jdt.core.prefs
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 added CarGarage/bin/Car.class
Binary file not shown.
Binary file added CarGarage/bin/Garage.class
Binary file not shown.
Binary file added CarGarage/bin/GarageArray$Garage.class
Binary file not shown.
Binary file added CarGarage/bin/GarageArray.class
Binary file not shown.
66 changes: 66 additions & 0 deletions CarGarage/src/Car.java
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;
}

}
77 changes: 77 additions & 0 deletions CarGarage/src/Garage.java
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;
}
}
}
86 changes: 86 additions & 0 deletions CarGarage/src/GarageArray.java
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;
}
}

}


}
10 changes: 10 additions & 0 deletions Clock/.classpath
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>
17 changes: 17 additions & 0 deletions Clock/.project
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>
12 changes: 12 additions & 0 deletions Clock/.settings/org.eclipse.jdt.core.prefs
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 added Clock/bin/Clock.class
Binary file not shown.
Binary file added Clock/bin/ClockTest.class
Binary file not shown.
Loading

0 comments on commit ff783c0

Please sign in to comment.