Given the following code below: public class Calculation { //method that returns cube of the given number public int findMax(int...

70.2K

Verified Solution

Question

Programming

  1. Given the following code below:
  1. public class Calculation{
  2. //method that returns cube of the given number
  3. public intfindMax(int arr[]){
  4.    int max=0;
  5.    for(inti=1;i
  6.        if(max
  7.           max=arr[i];}
  8.     }
  9.     return max;
  10.   }
  11. //method that returns cube of the given number
  12.   public staticint cube(int n){
  13.        returnn*n*n;
  14.     }
  15.   }
  1. (5 points) Define the class CalculationTest a subclass ofTestCase
  2. (10 points) Define a setUp() method
  3. (20 points) Define a test method testfindMax thatexercises Calculation.findMax() in Calculation class
  4. (5 points)Define a tearDown() method
  5. Bonus points (20 points ~1% of total grade):
    • (5 points) Define a test suite method
    • (10 points) Define a test method testcube thatexercises Calculation.cube() in Calculation class
    • (5 points) Organize your tests in your test suite(testfindMax & testcube)

Thelanguage is Java

Answer & Explanation Solved by verified expert
4.5 Ratings (773 Votes)
Program Code Screenshot    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students