Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit-1-bootcamp-assessment #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
10. Submit a pull request with all your code.


Test Start time: Thu May 28, 7:00pm EST
Test Start time: Thu May 28, 7:15pm EST

My End time: `<insert here>`
My End time: Thu May 28, 8:21pm EST

Test End time: Fri May 29, 10:00pm EST

Total time: 27 hours
Total time: 1 hour 6 minutes
17 changes: 14 additions & 3 deletions src/Exercises.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
public class Exercises {

static class Parent {
public String doStuff() { return ""; }
public String doStuff() { return "parent"; }
}
static class Child extends Parent {
public String doStuff() { return ""; }
public String doStuff(String s) { return ""; }
public String doStuff() { return "child"; }
public String doStuff(String s) { return s; }
}

public static void main(String[] args)
{
Parent mom = new Parent();
Child son = new Child();

System.out.println(mom.doStuff());
System.out.println(son.doStuff());
System.out.println(son.doStuff("Hello!"));

}


Expand Down
7 changes: 4 additions & 3 deletions src/MyNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
* Created by amyquispe on 5/28/15.
*/
public abstract class MyNode<T> {
private MyNode left;
private MyNode right;
private T data;
protected MyNode left;
protected MyNode right;
protected T data;

public abstract MyNode getLeft();

Expand All @@ -13,6 +13,7 @@ public abstract class MyNode<T> {
public abstract T getData();

public abstract void insert(MyNode<T> newNode);

public boolean contains(T someData){
if(getData()==null && someData == null){
return false;
Expand Down
49 changes: 49 additions & 0 deletions src/MyObject.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* Created by c4q-anthonyf on 5/28/15.
*/
public class MyObject
{
String name;
int age;

public MyObject(String name, int age){
this.name = name;
this.age = age;
}

public String getName(){
return name;
}

public int getAge(){
return age;
}

public boolean equals(MyObject object){
return name.equals(object.getName());
}

public void setName(String name){
this.name = name;
}

public void setAge(int age){
this.age = age;
}

public static void main(String[] args)
{
MyObject person = new MyObject("Thomas Edison", 168);
System.out.println(person.getName());
System.out.println(person.getAge());

person.setName("Anthony");
person.setAge(26);
System.out.println();
System.out.println(person.getName());
System.out.println(person.getAge());

}


}
59 changes: 59 additions & 0 deletions src/MyObjectNode.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import java.util.ArrayList;

/**
* Created by c4q-anthonyf on 5/28/15.
*/
public class MyObjectNode<T> extends MyNode
{
ArrayList<MyNode> nodes;

public MyObjectNode(){
super();
nodes = new ArrayList<MyNode>();
}

@Override
public MyNode getLeft()
{
return left;
}

@Override
public MyNode getRight()
{
return right;
}

@Override
public Object getData()
{
return data;
}

@Override
public void insert(MyNode newNode)
{
nodes.add(newNode);
}

public ArrayList<MyNode> getNodes(){
return nodes;
}

public void setLeft(MyNode left){
this.left = left;
}

public void setRight(MyNode right){
this.right = right;
}

public void setData(T data){
this.data = data;
}

public static void main(String[] args)
{

}
}
4 changes: 2 additions & 2 deletions src/Tests.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void test04MyObjectNodeImplementsSetters() throws Exception {
ClassLoader cl = ClassLoader.getSystemClassLoader();
Class<?> klass = cl.loadClass("MyObjectNode");
Method[] methods = klass.getMethods();
ArrayList<String> methodNames = new ArrayList<>();
ArrayList<String> methodNames = new ArrayList<String>();
for (Method m : methods){
methodNames.add(m.getName());
}
Expand All @@ -60,7 +60,7 @@ public void test05MyObjectHasNameAndAge() throws Exception {
Class<?> klass = cl.loadClass("MyObject");

Method[] methods = klass.getMethods();
ArrayList<String> methodNames = new ArrayList<>();
ArrayList<String> methodNames = new ArrayList<String>();
for (Method m : methods){
methodNames.add(m.getName());
}
Expand Down