Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please solve this Part 3 - Coding Problems 20. (8 pts) You have the following test routine: package spring 2020. DogAndCat Interface: import statie org.unit.jupiter.api.Assertions.

image text in transcribed

please solve this

Part 3 - Coding Problems 20. (8 pts) You have the following test routine: package spring 2020. DogAndCat Interface: import statie org.unit.jupiter.api.Assertions. import org.unit.jupiter.api. BeforeAll import org. junit.jupiter.api.BeforeEach; import org. junit.jupiter.api. Test; class Animal Test @BeforeAll static void setUpBeforeClass() throws Exception @Before Each void setup() throws Exception Test void test() { Dog Riker = new Dog ("Riker"); assertEquals (Riker.getName(), "Riker"); Cat Skippy = new Cat ("Skippy"); assertEquals (Skippy.getName(), "Skippy"); @Test void testArray() { Dog Riker = new Dog ("Riker"); Animal [] pets = {Riker, new Cat ("Skippy") }; StringBuilder sb = new StringBuilder (); for (Animal pet: pets) { sb.append(pet.getName()); assertEquals ("RikerSkippy", sb.toString(); Write Animal, Dog, and Cat classes. Try to put as much code as you can into Animal so that Dog and Cat have the least amount of code

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

50 Tips And Tricks For MongoDB Developers Get The Most Out Of Your Database

Authors: Kristina Chodorow

1st Edition

1449304613, 978-1449304614

More Books

Students also viewed these Databases questions

Question

4-6 Is there a digital divide? If so, why does it matter?

Answered: 1 week ago