Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is my code and my tester file but i am getting this error I don't know why. can anyone help me with this? package

This is my code and my tester file but i am getting this error I don't know why. can anyone help me with this?

package p1;

public class Task2 {

public static String quadrant(int x, int y) { if (x > 0 && y > 0) { return "first"; } else if (x < 0 && y > 0) { return "second"; } else if (x < 0 && y < 0) { return "third"; } else if (x > 0 && y < 0) { return "fourth"; } else { return "none"; } }

public static int sumCubes(int a, int b) { int total = 0; for(int i = a; i <= b; ++i) { total += Math.pow(i, 3); } return total; }

}

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

import org.junit.*; import static org.junit.Assert.*; import java.util.*; public class Task2Tests { public static void main(String args[]){ org.junit.runner.JUnitCore.main("Task2Tests"); } @Test public void task2_quadrant_01 (){ assertEquals( "first", Task2.quadrant( 4, 5)); } @Test public void task2_quadrant_02 (){ assertEquals( "second", Task2.quadrant( -6, 7)); } @Test public void task2_quadrant_03 (){ assertEquals( "third", Task2.quadrant( -9, -8)); } @Test public void task2_quadrant_04 (){ assertEquals( "fourth", Task2.quadrant( 10, -3)); } @Test public void task2_quadrant_05 (){ assertEquals( "none", Task2.quadrant( 5, 0)); } @Test public void task2_quadrant_06 (){ assertEquals( "none", Task2.quadrant( 0, -3)); } @Test public void task2_quadrant_07 (){ assertEquals( "none", Task2.quadrant( 0, 0)); } @Test public void task2_quadrant_08 (){ assertEquals( "first", Task2.quadrant( 1, 1)); } @Test public void task2_quadrant_09 (){ assertEquals( "second", Task2.quadrant(-100, 100)); } @Test public void task2_quadrant_10 (){ assertEquals( "fourth", Task2.quadrant( 300,-456)); } @Test public void task2_sumCubes_01 (){ assertEquals( 36, Task2.sumCubes( 0, 3)); } @Test public void task2_sumCubes_02 (){ assertEquals( 36, Task2.sumCubes( 1, 3)); } @Test public void task2_sumCubes_03 (){ assertEquals( 224, Task2.sumCubes( 2, 5)); } @Test public void task2_sumCubes_04 (){ assertEquals( 2925, Task2.sumCubes( 5, 10)); } @Test public void task2_sumCubes_05 (){ assertEquals( 855, Task2.sumCubes( 7, 8)); } @Test public void task2_sumCubes_06 (){ assertEquals( 64, Task2.sumCubes( 4, 4)); } @Test public void task2_sumCubes_07 (){ assertEquals( 1000, Task2.sumCubes( 10, 10)); } @Test public void task2_sumCubes_08 (){ assertEquals( 0, Task2.sumCubes( 10, 9)); } @Test public void task2_sumCubes_09 (){ assertEquals( 0, Task2.sumCubes(100, 1)); } @Test public void task2_sumCubes_10 (){ assertEquals( 2121155136, Task2.sumCubes( 1, 303)); }

}

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

this error shows up,

Unit version 4.12

.E

Time: 0.002

There was 1 failure:

1) initializationError(org.junit.runner.JUnitCommandLineParseResult)

java.lang.IllegalArgumentException: Could not find class [Task2Tests]

at org.junit.runner.JUnitCommandLineParseResult.parseParameters(JUnitCommandLineParseResult.java:102)

at org.junit.runner.JUnitCommandLineParseResult.parseArgs(JUnitCommandLineParseResult.java:50)

at org.junit.runner.JUnitCommandLineParseResult.parse(JUnitCommandLineParseResult.java:44)

at org.junit.runner.JUnitCore.runMain(JUnitCore.java:72)

at org.junit.runner.JUnitCore.main(JUnitCore.java:36)

at p1.Task2Tests.main(Task2Tests.java:25)

Caused by: java.lang.ClassNotFoundException: Task2Tests

at java.net.URLClassLoader.findClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Unknown Source)

at org.junit.internal.Classes.getClass(Classes.java:16)

at org.junit.runner.JUnitCommandLineParseResult.parseParameters(JUnitCommandLineParseResult.java:100)

... 5 more

FAILURES!!!

Tests run: 1, Failures: 1

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_2

Step: 3

blur-text-image_3

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

More Books

Students also viewed these Databases questions

Question

sharing of non-material benefits such as time and affection;

Answered: 1 week ago