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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
jax-ftd-day-4-java-assignment
===
[![Build Status](https://travis-ci.org/Abiyaruth/jax-ftd-day-4-java-assignment.svg?branch=Abiyaruth)](https://travis-ci.org/Abiyaruth/jax-ftd-day-4-java-assignment)
47 changes: 27 additions & 20 deletions src/main/java/com/cooksys/butterpillar/model/Butterpillar.java
Original file line number Diff line number Diff line change
@@ -1,34 +1,41 @@
package com.cooksys.butterpillar.model;

public class Butterpillar {

// any instance fields should be private

public double getLength() {
return 0; // TODO: to be implemented
public class Butterpillar {
double Length;
double LeavesEaten;
public Butterpillar()
{
}

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

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

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

public boolean equals(Butterpillar b) {
return false; // TODO: to be implemented
public double getLeavesEaten() {
return LeavesEaten;
}
public void setLeavesEaten(double LeavesEaten) {
this.LeavesEaten = LeavesEaten;
}

@Override
public String toString() {
return null; // TODO: to be implemented
return "Butterpillar [length:" +Length+ ",leavesEaten: "+LeavesEaten+ "]";
}
public boolean equals(Butterpillar b){
if(b.Length!=Length)
{
return false;
}else {
return true;
}
}

@Override
public boolean equals(Object o) {
if (o instanceof Butterpillar) {
Expand Down
52 changes: 32 additions & 20 deletions src/main/java/com/cooksys/butterpillar/model/Catterfly.java
Original file line number Diff line number Diff line change
@@ -1,34 +1,46 @@
package com.cooksys.butterpillar.model;

public class Catterfly {

// any instance fields should be private

public double getWingspan() {
return 0; // to be implemented
public class Catterfly {
double Wingspan;
double Weight;
public Catterfly()
{

}

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

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


public double getWingspan() {
return Wingspan;
}

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

public boolean equals(Catterfly c) {
return false; // TODO: to be implemented
public double getWeight() {
return Weight;
}

public void setWeight(double Weight) {
this.Weight = Weight;
}


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

public boolean equals(Catterfly c){
if(c.Wingspan!=Wingspan)
{
return false;
}else {
return true;
}
}
@Override
public boolean equals(Object o) {
if (o instanceof Catterfly) {
Expand Down
36 changes: 28 additions & 8 deletions src/main/java/com/cooksys/butterpillar/model/GrowthModel.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package com.cooksys.butterpillar.model;

public class GrowthModel {

double LengthToWingspan;
double LeavesEatenToWeight;
// any instance fields should be private

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

Expand All @@ -19,18 +20,37 @@ public double getLeavesEatenToWeight() {
public void setLeavesEatenToWeight(double leavesEatenToWeight) {
// to be implemented
}

*/
public Catterfly butterpillarToCatterfly(Butterpillar butterpillar) {
return null; // to be implemented
return new Catterfly(butterpillar.Length*LengthToWingspan,butterpillar.LeavesEaten*LeavesEatenToWeight);
}

public double getLengthToWingspan() {
return LengthToWingspan;
}

public void setLengthToWingspan(double lengthToWingspan) {
LengthToWingspan = lengthToWingspan;
}

public double getLeavesEatenToWeight() {
return LeavesEatenToWeight;
}

public void setLeavesEatenToWeight(double leavesEatenToWeight) {
LeavesEatenToWeight = leavesEatenToWeight;
}

public Butterpillar catterflyToButterpillar(Catterfly catterfly) {
return null; // to be implemented
return new Butterpillar(catterfly.Wingspan/LengthToWingspan, catterfly.Weight/LeavesEatenToWeight);
}

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

return false;}else
// TODO: to be implemented
return false;
}

@Override
public String toString() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.cooksys.butterpillar.test.model;

import static org.junit.Assert.fail;
//import static org.junit.Assert.fail;

import java.util.ArrayList;
import java.util.List;
Expand Down