Question: a) Create a JUnit test file called GeometryTest.java and a java file Geometry.java. in the JUnit test add the following four stub methods testAreaRect() testPerimeterRect()

a) Create a JUnit test file called GeometryTest.java and a java file Geometry.java. in the JUnit test add the following four stub methods

  • testAreaRect()
  • testPerimeterRect()
  • testVolumeSphere()
  • testSurfaceAreaSphere()

In the regular java file add the following stub methods

  • float areaRect(float width, float height)
  • float perimeterRect(float width, float height)
  • float volumeSphere(float radius)
  • float surfaceAreaSphere(float radius)

b) Write four test cases for each test method that calls the appropriate method in the java file. You should not write code in the regular java file for now. As you are dealing with floating point numbers. Your margin for error (epsilon) is 0.1

c) Write the code for the methods in Geometry.java You may only move onto the next method once the unit test has been satisfied.

java

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!