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

Abassawo #7

Open
wants to merge 2 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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ My End time: `<insert here>`
Test End time: Fri May 29, 10:00pm EST

Total time: 27 hours


50 minutes or so to complete assessment.
13 changes: 10 additions & 3 deletions src/Exercises.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
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 "Howdy"; }
}

public static void main(String[] args) {
MyObjectNode x = new MyObjectNode();
x.setLeft();
x.setRight();
x.setData();
}


Expand Down
44 changes: 44 additions & 0 deletions src/MyObject.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* Created by c4q-Abass on 5/28/15.
*/
public class MyObject {

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;
}

private String name;
private int age;


public MyObject(){
this.name="";
this.age=0;
}

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

public boolean isEqual(MyObject s){
return ((this.name == s.getName())
&& (this.age == s.getAge())
);
}



}
43 changes: 43 additions & 0 deletions src/MyObjectNode.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/**
* Created by c4q-Abass on 5/28/15.
*/
public class MyObjectNode extends MyNode {
private MyNode left, right, data;
@Override
public MyNode getLeft() {
return null;
}

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

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

@Override
public void insert(MyNode newNode) {
//add this my node
}


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, probably not quite how that API would work but I see where you're going

public void setLeft(){
this.insert(left);

}

public void setRight(){
this.insert(right);
}
public void setData(){
this.insert(right);
}

public static void main(String[] args) {
MyObject x = new MyObject();
}

}
5 changes: 3 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 @@ -54,13 +54,14 @@ public void test04MyObjectNodeImplementsSetters() throws Exception {
}
}


@Test
public void test05MyObjectHasNameAndAge() throws Exception {
ClassLoader cl = ClassLoader.getSystemClassLoader();
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