Skip to content

Commit

Permalink
Feat: Coding lesson 07 object and test file
Browse files Browse the repository at this point in the history
  • Loading branch information
“Kyvon authored and “Kyvon committed Mar 19, 2024
1 parent adfd87d commit 6faf57e
Show file tree
Hide file tree
Showing 2 changed files with 140 additions and 0 deletions.
100 changes: 100 additions & 0 deletions lesson_07/objects/objects_app/src/main/kyvonthompson/Frog.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
package com.codedifferently.lesson7.kyvonthompson;



public class frog {
//Frog Attributes

private String color;
private int age; //Age in years
private int size; //Size in inches
private double weight; //Weigh in pounds
private String breed;

//Constructer to create brand new frogger
public frog(String color, int age, int size, double weight, String breed) {

this.color = color;
this.age = age;
this.size = size;
this.weight = weight;
this.breed = breed;

}
public enum frogColor {
GREEN,
BLUE,
RED,
PURPLE,
PINK,
WHITE,
BROWN,
}

public enum frogType {
TREE_FROG,
BULLFROG,
POISON_DART_FROG,
LEOPARD_FROG,
COMMON_FROG,
GLASS_FROG
}
// Behaviors of a Frog

// The frog jumps
public void jump() {
System.out.println("The " + color + " frog jumps!");
}

// The frog croaks
public void croak() {
System.out.println("The " + color + " frog says: Croak!");
}

// Getter for color
public String getColor() {
return color;
}

// Setter for color
public void setColor(String color) {
this.color = color;
}

// Getter for size
public int getSize() {
return size;
}

// Setter for size
public void setSize(int size) {
this.size = size;
}

// Getter for age
public int getAge() {
return age;
}

// Setter for age
public void setAge(int age) {
this.age = age;
}
// Getter for weight
public double getWeight() {
return weight;
}
// Setter for weight
public void setWeight(double weight) {
this.weight = weight;
}
// Getter for breed
public String getBreed(){
return breed;
}
// Setter for breed
public void setBreed(String breed){
this.breed = breed;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.codedifferently.lesson7.kyvonthompson;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;

import org.junit.jupiter.api.Test;


public class Frog {

public Frog(String string, int i, int j, double d, String string2) {



@Test
// Frog actions
public void testjump() {

// Creating a new Frog instance
Frog frog = new Frog("green", 5, 2, 8.2, "bulletFrog");
// Getting frog details
assertEquals("The green frog jumps!", frog.jumps());
}

private Frogtest jumps() {
throw new UnsupportedOperationException("Unimplemented method 'jumps'");
}
}
// System.out.println(
// "frog details: Color - "
// + frog.getColor()
// + ", Size - "
// + frog.getSize()
// + ", Age - "
// + frog.getAge()
// + ",Weight - "
// + frog.getWeight()
// + ",Weight"
// + frog.getBreed());

0 comments on commit 6faf57e

Please sign in to comment.