Question: consider java to do this question please: Add to the class a method called flawedMethod2 that contains a division by zero faults such that (1)

consider java to do this question please:

  • Add to the class a method called flawedMethod2 that contains a division by zero faults such that (1) it is possible to create a test suite that achieves less than 100% statement coverage and reveals the fault, and (2) every test suite that achieves 100% statement coverage does not reveal the fault.
    • The method can have any signature.
    • If you think it is not possible to create a method meeting both requirements, then:
      • create an empty method.

add a comment in the (empty) body of the method that concisely but convincingly explains why creating such a method is not possible.

You don't need to run the program since chegg not allowing me to pass all the tester code here:

Here is the code i need you to modify it for the above work please:

FlawedClass.java packageedu.gatech.seclass; public class FlawedClass { Public int flawedMethod1(int x, boolean s, boolean c) { if (s) { x++ } else { x-- } if (c){ x += 2 } else { x -= 2 } return x / (x + 1); } Task 2

Task 3 Public boolean flawedMethod3(boolean a, boolean b) { int x = 2; int y = 6; if (a){ x = 4; } else{ y = y / x; } if (b){ x --; } else { x ++; } return ((2 / (y - x) >= 1); }

Task 4 public boolean flawedMethod4 (boolean a, boolean b) { int x = 2; int y = 6; if(a) x = 4; else y = y / x; if(b) x -= 1; else x += 1; return ((2/(y-x)) >= 1); }

// | a | b |output| // ================ // | T | T | | // | T | F | | // | F | T | | // | F | F | | // ================ // Coverage required: __________

}

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!