Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ buildNumber.properties

# Avoid ignoring Maven wrapper jar file (.jar files are usually ignored)
!/.mvn/wrapper/maven-wrapper.jar
/.metadata/
/.metadata/
1 change: 1 addition & 0 deletions HeyYou.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Roll Tide!
6 changes: 6 additions & 0 deletions LookAhead/ProjectMayhem/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
17 changes: 17 additions & 0 deletions LookAhead/ProjectMayhem/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ProjectMayhem</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>
11 changes: 11 additions & 0 deletions LookAhead/ProjectMayhem/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
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.source=1.8
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions LookAhead/ProjectMayhem/input.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MAn i just love talking aout file io especially when everyone is probably just working on the homework or project. woe is me.
1 change: 1 addition & 0 deletions LookAhead/ProjectMayhem/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Roll Tide
Binary file added LookAhead/ProjectMayhem/person.txt
Binary file not shown.
83 changes: 83 additions & 0 deletions LookAhead/ProjectMayhem/src/com/revature/beans/Person.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package com.revature.beans;

import java.io.Serializable;

import com.revature.exceptions.IncreasedByNegativeNumberException;

public class Person implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;

/*
* Members of a class
* Instance variables-property of one specific object
* Static variables- property of class/shared by all instances of this class
* Instance methods-behavior relative to a specific object
* Static methods-behavior relative to the entire class
* Constructors- instantiates the class using the keyword "new"
*/
/*Code Blocks-a block of code...
*
*instance code block- execute before constructor when an object is
*instantiated.
*{....}
*Static code- execute once, when class is loaded in JVM
*/

//Instance code block
{System.out.println("I'm in the instance code block");}
static {System.out.println("I'm in a static code block");}

private static String homePlanet = "earth";
private String name;
private int age;
private int weight;

public Person(){
super();
}
public Person(String name, int age, int weight) {
this.name= name;
this.age = age;
this.weight = weight;
}
public static String getHomePlanet() {
return homePlanet;
}
public static void setHomePlanet(String homePlanet) {
Person.homePlanet = homePlanet;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public int getWeight() {
return weight;
}
public void setWeight(int weight) {
this.weight = weight;
}
@Override
public String toString() {
return "Person [name=" + name + ", age=" + age + ", weight=" + weight + "]";
}

public void increaseAgeBy(int x) throws
IncreasedByNegativeNumberException {
if(x<=0) {
throw new IncreasedByNegativeNumberException();
}
this.age+=x;
}

}
38 changes: 38 additions & 0 deletions LookAhead/ProjectMayhem/src/com/revature/brainteaser/Hawk.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.revature.brainteaser;

class Bird{
{ System.out.println("b1"); }
Bird() {

System.out.println("b2");
}

static {
System.out.println("b3");
}
}

class Raptor extends Bird {
static { System.out.println("r1"); }

public Raptor() {

System.out.println("r2");
}

{ System.out.println("r3"); }

static { System.out.println("r4"); }
}

public class Hawk extends Raptor {

public static void main(String[] args) {
System.out.println("init");
new Hawk();
System.out.println("hawk");
}

public Hawk() {
}
}
39 changes: 39 additions & 0 deletions LookAhead/ProjectMayhem/src/com/revature/chaining/Mouse.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.revature.chaining;

public class Mouse {
//constructor chaining- overloading constructors to call each other



private int numTeeth;
private int numWhiskers;
private int weight;

@Override
public String toString() {
return "Mouse [numTeeth=" + numTeeth + ", numWhiskers=" + numWhiskers + ", weight=" + weight + "]";
}


public Mouse(int numTeeth, int numWhiskers) {
this(numTeeth,numWhiskers,6);
}
public Mouse (int numTeeth) {
this(numTeeth, 10);
}
public Mouse(int numTeeth, int numWhiskers, int weight) {
super();
this.numTeeth = numTeeth;
this.numWhiskers = numWhiskers;
this.weight = weight;
}
public static void main(String[] args) {
Mouse m= new Mouse(20);
System.out.println(m.toString());
Mouse m2 = new Mouse(2,94);
System.out.println(m2.toString());

}


}
10 changes: 10 additions & 0 deletions LookAhead/ProjectMayhem/src/com/revature/classtypes/Animal.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.revature.classtypes;
/*
* special class that can't be instantiated
* they contain at least 1 abstract methods
* can contain concrete methods
* "Contract based"- abstract methods MUST be overriden in subclass
*/
public abstract class Animal {
public abstract void breathe();
}
12 changes: 12 additions & 0 deletions LookAhead/ProjectMayhem/src/com/revature/classtypes/Driver.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.revature.classtypes;

public class Driver {

public static void main(String[] args) {
Shark shark =new Shark();
shark.breathe();
shark.findPrey();

}

}
17 changes: 17 additions & 0 deletions LookAhead/ProjectMayhem/src/com/revature/classtypes/Hunt.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.revature.classtypes;

public interface Hunt {
/*
* specify what a class must do, but not how it does it(abstraction!)
* special type of class that cannot be instantiated
* lack instance variables
* can mimic multiple inheritence w/ interfaces
* Methods are declared w/o body
* classes can implement interfaces 0+
* interfaces can extend other interfaces 0+
* All variables are implicitly static, public, and final (java8)
*
*
*/
public abstract void findPrey();
}
17 changes: 17 additions & 0 deletions LookAhead/ProjectMayhem/src/com/revature/classtypes/Shark.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.revature.classtypes;

public class Shark extends Animal implements Hunt{

@Override
public void findPrey() {
System.out.println(" I ate fishes!");

}

@Override
public void breathe() {
System.out.println("I breathe underwater");

}

}
51 changes: 51 additions & 0 deletions LookAhead/ProjectMayhem/src/com/revature/compare/CompareMain.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package com.revature.compare;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class CompareMain {

public static void main(String[] args) {
List<Student> studentList = new ArrayList<Student>();
studentList.addAll(Arrays.asList(
new Student [] {
new Student(15,"Matt", 9.51),
new Student(67,"Kevin",1.4),
new Student(3,"Haramb$",4.0),
new Student(16,"Miguelh",1.3),
new Student(24, "Jesush", 4.1),
new Student(8, "Luciferh",6.66),
new Student(45, "Raleigh$Z",3.9),
new Student(51,"President Barack Obama",3.0),
new Student(52,"DB",0.0)
}));
System.out.println("Original List");
for (Student s:studentList) {
System.out.println(s);
}
System.out.println("================");
Collections.sort(studentList);
System.out.println("Sorted by StudentID");
for (Student s:studentList) {
System.out.println(s);
}
System.out.println("================");
Collections.sort(studentList, new StudentComparator());
System.out.println("Sorted by GPA:");
for (Student s:studentList) {
System.out.println(s);
}
System.out.println("================");
System.out.println("Sort by Label w/ lambda");
//Sort by Label with lambda
Collections.sort(studentList,(arg0,arg1)
->{return arg0.getLabel().compareTo(arg1.getLabel());}
);
for (Student s:studentList) {
System.out.println(s);
}
}

}
47 changes: 47 additions & 0 deletions LookAhead/ProjectMayhem/src/com/revature/compare/Student.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package com.revature.compare;

public class Student implements Comparable<Student>{
//1st method of comparing- Implement Comparable
private int studentID;
private String label;
private double gpa;
public Student() {
super();
// TODO Auto-generated constructor stub
}
public Student(int studentID, String label, double gpa) {
super();
this.studentID = studentID;
this.label = label;
this.gpa = gpa;
}
public int getStudentID() {
return studentID;
}
public void setStudentID(int studentID) {
this.studentID = studentID;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public double getGpa() {
return gpa;
}
public void setGpa(double gpa) {
this.gpa = gpa;
}
@Override
public String toString() {
return "Student [studentID=" + studentID + ", label=" + label + ", gpa=" + gpa + "]";
}
@Override
public int compareTo(Student arg0) {
//compare studentID
return this.getStudentID() - arg0.getStudentID();
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.revature.compare;

import java.util.Comparator;

//Method2 of comparing
//External class that implements Comparator
public class StudentComparator implements Comparator<Student>{
//implement this method from the Comparator Interface-Comparing GPAs
@Override
public int compare(Student arg0, Student arg1) {
return (int)(arg0.getGpa() - arg1.getGpa());
}

}
Loading