Consider the following problem for computing the monthly utility bill as formulated by Rob Hierons to illustrate coincidental correctness. Let W and E denote, respectively, the monthly water and...

Consider the following problem for computing the monthly utility bill as formulated by Rob Hierons to illustrate coincidental correctness. Let W and E denote, respectively, the monthly water and electricity consumption in standard units. Let Cw and Ce denote, respectively, the costs of consuming one standard unit of water and electricity. The monthly charge to the customer is computed as: (Cw ∗ W + Ce ∗ E). However, in situations where a customer uses at least Mw units of water, a 20% discount is applied to the electricity portion of the charge. In this case, the charge to the customer is computed as (Cw ∗ W + 0.2 ∗ Ce ∗E). Now suppose that Mw = 30 but while coding the computation of the monthly utility charge, the programmer has used by mistake Mw = 40. Thus, instead of using the condition W ≥ 30 the programmer uses the condition W ≥ 40 to select one of the two formulae above to compute the monthly utility charges. Assume that the function under test (in Java) is as given below. 1 public double incorrectHierons(double w, double e, double cw, double ce){ 2 final double mw=40; // Should be 30. 3 final double discount=0.2; 4 if(w>=mw){ 5 return(w*cw+discount*ce*e); 6 }else{ 7 return(w*cw+ce*e); 8 } 9 } (a) Use boundary value analysis to determine test inputs to test the (incorrect) function to compute the utility bill. (b) Use partition testing techniques to derive the test cases to test the (incorrect) function to compute the utility bill. (c) Under what conditions will your test fail to discover the error?

May 26, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here