Using Java Do whatever you understand i will thumbs up Bellow is animal class(actor class is not needed). Create a test class for animal, there will be a skeleton code underneath animal class to help u create this test class. public class Animal extends Actor { //~ Fields ................................................................ private int age; private int speed; //~ Constructor ........................................................... // ---------------------------------------------------------- / * Creates a new Animal object. * * @param speed The speed at which this animal moves (number * of cells per turn). */ public Animal(int speed) { age = 0; this.speed = speed; } //~ Methods ............................................................... // ---------------------------------------------------------- / * Get the age of this animal, in number of turns. * * @return This animal's age. */ public double getAge() { return age; } // ---------------------------------------------------------- / * Get the speed of this animal, in number of cells moved per * turn. * * @return This animal's speed. */ public int getSpeed() { return speed; } // ---------------------------------------------------------- / * Pick a new direction for this animal. The implementation * in this class turns a random amount between +45 and -45 * degrees. Subclasses can override this behavior to use a * different turning strategy. */ public void turn() { int angle = Random.generator().nextInt(90) - 45; this.turn(angle); } // ---------------------------------------------------------- /** * Execute this animal's behavior for one turn. */ public void act() { age++; this.turn(); this.move(getSpeed()); } } ----------------------------------------------------------------------------------------- Skeloton code below public class AnimalTest extends TestCase { //~ Fields ................................................................ //~ Constructor ........................................................... // ---------------------------------------------------------- / * Creates a new AnimalTest test object. */ public AnimalTest() { // The constructor is usually empty in unit tests, since it runs // once for the whole class, not once for each test method. // Per-test initialization should be placed in setUp() instead. } //~ Methods ............................................................... // ---------------------------------------------------------- / * Sets up the test fixture. * Called before every test case method. / public void setUp() { /# Insert your own setup code here / } // ---------------------------------------------------------- /# Insert your own test methods here */ }

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

Using Java

Do whatever you understand i will thumbs up

Bellow is animal class(actor class is not needed). Create a test class for animal, there will be a skeleton code underneath animal class to help u create this test class.

public class Animal extends Actor
{
//~ Fields ................................................................

private int age;
private int speed;


//~ Constructor ...........................................................

// ----------------------------------------------------------
/
* Creates a new Animal object.
*
* @param speed The speed at which this animal moves (number
* of cells per turn).
*/
public Animal(int speed)
{
age = 0;
this.speed = speed;
}


//~ Methods ...............................................................

// ----------------------------------------------------------
/
* Get the age of this animal, in number of turns.
*
* @return This animal's age.
*/
public double getAge()
{
return age;
}


// ----------------------------------------------------------
/
* Get the speed of this animal, in number of cells moved per
* turn.
*
* @return This animal's speed.
*/
public int getSpeed()
{
return speed;
}


// ----------------------------------------------------------
/
* Pick a new direction for this animal. The implementation
* in this class turns a random amount between +45 and -45
* degrees. Subclasses can override this behavior to use a
* different turning strategy.
*/
public void turn()
{
int angle = Random.generator().nextInt(90) - 45;
this.turn(angle);
}


// ----------------------------------------------------------
/**
* Execute this animal's behavior for one turn.
*/
public void act()
{
age++;
this.turn();
this.move(getSpeed());
}
}

-----------------------------------------------------------------------------------------

Skeloton code below

public class AnimalTest extends TestCase
{
//~ Fields ................................................................


//~ Constructor ...........................................................

// ----------------------------------------------------------
/
* Creates a new AnimalTest test object.
*/
public AnimalTest()
{
// The constructor is usually empty in unit tests, since it runs
// once for the whole class, not once for each test method.
// Per-test initialization should be placed in setUp() instead.
}


//~ Methods ...............................................................

// ----------------------------------------------------------
/
* Sets up the test fixture.
* Called before every test case method.
/
public void setUp()
{
/# Insert your own setup code here /
}


// ----------------------------------------------------------
/# Insert your own test methods here */

}

Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Developing computer interface
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education