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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
language: java
jdk:
- oraclejdk8
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
jax-ftd-day-4-java-assignment
===



[![Build Status](https://travis-ci.org/arturlan/jax-ftd-day-4-java-assignment.svg?branch=arturlan)](https://travis-ci.org/arturlan/jax-ftd-day-4-java-assignment)
35 changes: 28 additions & 7 deletions src/main/java/com/cooksys/butterpillar/model/Butterpillar.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,53 @@
public class Butterpillar {

// any instance fields should be private
private double length;
private double leavesEaten;

public Butterpillar() {

}



public Butterpillar(double length, double leavesEaten) {
super();
this.length = length;
this.leavesEaten = leavesEaten;
}



public double getLength() {
return 0; // TODO: to be implemented
return length;
}

public void setLength(double length) {
// TODO: to be implemented
this.length = length;
}

public double getLeavesEaten() {
return 0; // TODO: to be implemented
return leavesEaten;
}

public void setLeavesEaten(double leavesEaten) {
// TODO: to be implemented
this.leavesEaten = leavesEaten;
}

public boolean equals(Butterpillar b) {
if(b.length == length && b.leavesEaten == leavesEaten) {
return true;
}
return false; // TODO: to be implemented
}



@Override
public String toString() {
return null; // TODO: to be implemented
return "Butterpillar [length=" + length + ", leavesEaten=" + leavesEaten + "]";
}

@Override
public boolean equals(Object o) {
if (o instanceof Butterpillar) {
Expand Down
33 changes: 27 additions & 6 deletions src/main/java/com/cooksys/butterpillar/model/Catterfly.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,53 @@
public class Catterfly {

// any instance fields should be private
private double wingspan;
private double weight;

public Catterfly() {

}



public Catterfly(double wingspan, double weight) {
super();
this.wingspan = wingspan;
this.weight = weight;
}



public double getWingspan() {
return 0; // to be implemented
return wingspan;
}

public void setWingspan(double wingspan) {
// to be implemented
this.wingspan = wingspan;
}

public double getWeight() {
return 0; // TODO: to be implemented
return weight;
}

public void setWeight(double weight) {
// TODO: to be implemented
this.weight = weight;
}


public boolean equals(Catterfly c) {
if (c.wingspan == wingspan && c.weight == weight) {
return true;
}
return false; // TODO: to be implemented
}


@Override
public String toString() {
return null; // TODO: to be implemented
return "Catterfly [wingspan=" + wingspan + ", weight=" + weight + "]";
}

@Override
public boolean equals(Object o) {
if (o instanceof Catterfly) {
Expand Down
21 changes: 12 additions & 9 deletions src/main/java/com/cooksys/butterpillar/model/GrowthModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,43 @@
public class GrowthModel {

// any instance fields should be private
private double lengthToWingspan;
private double leavesEatenToWeight;

public double getLengthToWingspan() {
return 0; // to be implemented
return lengthToWingspan;
}

public void setLengthToWingspan(double lengthToWingspan) {
// to be implemented
this.lengthToWingspan = lengthToWingspan;
}

public double getLeavesEatenToWeight() {
return 0; // to be implemented
return leavesEatenToWeight;
}

public void setLeavesEatenToWeight(double leavesEatenToWeight) {
// to be implemented
this.leavesEatenToWeight = leavesEatenToWeight;
}

public Catterfly butterpillarToCatterfly(Butterpillar butterpillar) {
return null; // to be implemented
return new Catterfly(butterpillar.getLength() * lengthToWingspan,
butterpillar.getLeavesEaten() * leavesEatenToWeight);
}

public Butterpillar catterflyToButterpillar(Catterfly catterfly) {
return null; // to be implemented
return new Butterpillar(catterfly.getWingspan() / lengthToWingspan, catterfly.getWeight() / leavesEatenToWeight);
}

public boolean equals(GrowthModel g) {
return false; // TODO: to be implemented
}

@Override
public String toString() {
return null; // TODO: to be implemented
}

@Override
public boolean equals(Object o) {
if (o instanceof GrowthModel) {
Expand Down