Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Students also viewed these Databases questions

Question

=+ Are ballots compulsory?

Answered: 1 week ago