Let us consider an instantiable class that contains a compute method to validate handles/aliases. The compute...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Let us consider an instantiable class that contains a compute method to validate handles/aliases. The compute method should work according to the following specification: the compute method should receive as an argument a piece of text (e. String) that represents an alias, and should check if the penultimate (.e., second to last) character of the alias is the symbol and the last character is the lower case letter z. When the alias ends with the two characters in the order mentioned earlier, the method should return the value true. Otherwise, when the alias does not end with the two specified characters the method should return the value false. Figure 4 presents a possible implementation. 2 public class AliasValidator { 4 9 10 11 12 13 15 16 17 public boolean validateAlias (String alias) { boolean validEnd; char lastCharacter = alias.charAt(0); char secondToLastCharacter alias.charAt(alias.length() - 2); if (secondToLastCharacter == '@' && lastCharacter == '2') { validEnd = true; } else { validEnd = false; } return validEnd; Figure 4 Source code for Question 2. B Implement all the required unit tests in order to achieve full code coverage according to the branch coverage technique. Run/execute the unit tests implemented at item a) and provide in your report a screenshot of the NetBeans Test Results Window that includes a summary of the execution of the unit tests (namely, for each unit test, the name of the test method run and whether the test has passed or failed). c) Implement all the required unit tests in order to check whether the compute method works according to expectation, namely according to the specification provided in Question 2. B. In case that there is any incorrect codellogic in the compute method, your unit test(s) should uncover such defects/bugs. d) Run/execute the unit tests implemented at item c) and provide in your report a screenshot of the NetBeans Test Results Window that includes a summary of the execution of the unit tests Let us consider an instantiable class that contains a compute method to validate handles/aliases. The compute method should work according to the following specification: the compute method should receive as an argument a piece of text (e. String) that represents an alias, and should check if the penultimate (.e., second to last) character of the alias is the symbol and the last character is the lower case letter z. When the alias ends with the two characters in the order mentioned earlier, the method should return the value true. Otherwise, when the alias does not end with the two specified characters the method should return the value false. Figure 4 presents a possible implementation. 2 public class AliasValidator { 4 9 10 11 12 13 15 16 17 public boolean validateAlias (String alias) { boolean validEnd; char lastCharacter = alias.charAt(0); char secondToLastCharacter alias.charAt(alias.length() - 2); if (secondToLastCharacter == '@' && lastCharacter == '2') { validEnd = true; } else { validEnd = false; } return validEnd; Figure 4 Source code for Question 2. B Implement all the required unit tests in order to achieve full code coverage according to the branch coverage technique. Run/execute the unit tests implemented at item a) and provide in your report a screenshot of the NetBeans Test Results Window that includes a summary of the execution of the unit tests (namely, for each unit test, the name of the test method run and whether the test has passed or failed). c) Implement all the required unit tests in order to check whether the compute method works according to expectation, namely according to the specification provided in Question 2. B. In case that there is any incorrect codellogic in the compute method, your unit test(s) should uncover such defects/bugs. d) Run/execute the unit tests implemented at item c) and provide in your report a screenshot of the NetBeans Test Results Window that includes a summary of the execution of the unit tests
Expert Answer:
Answer rating: 100% (QA)
1 Code Correction Ill correct the provided code snippet with proper syntax java public boolean isVal... View the full answer
Related Book For
Smith and Roberson Business Law
ISBN: 978-0538473637
15th Edition
Authors: Richard A. Mann, Barry S. Roberts
Posted Date:
Students also viewed these programming questions
-
23 Consider the following Java code: What will be printed when the following code is executed: new Cat().eat(); ? public class Animal ( } public void eat () { System.out.println("Animal is eating");...
-
Carol Harris, Ph.D, CPA, is a single taxpayer and she lives at 674 Yankee Street, Durham, NC 27409. Her Social Security number is 793-52-4335. Carol is an Associate Professor of Accounting at a local...
-
A registered dealer, based in Chandigarh, makes a supply to another registered dealer located in Chandigarh, valuing rupees 1,20,000. The applicable rate of GST is 12%. Calculate the amount of tax...
-
Need assistance on adding accounting info to the excel worksheet posted. A.) would 97,400 go under cash or fixed assets ? Number Styles Cells Editing Ideas g Cash Balance B. C D E H. K M T. 0,1,F...
-
The mold that is used in an injection molding process is constructed of metal (p = 7800 kg/m3, c = 450 J/kg K). The mold, to be heated to 190C prior to injection of the thermoplastic material, must...
-
At the beginning of the year, SnapIt had $10,000 of inventory. During the year, SnapIt purchased $35,000 of merchandise and sold $30,000 of merchandise. A physical count of inventory at year-end...
-
For each of the following situations, calculate a \(95 \%\) confidence interval for the mean ( \(\sigma\) known), beginning with the step, "Identify the critical value of \(z\)." X 50.00, X = 3.00 X...
-
Salvania Corporation is considering investing in Farnorth Corporation, but is unsure about what level of ownership should be undertaken. Salvania and Farnorth have the following reported incomes:...
-
As a project manager, you encounter a problem that will affect the project delivery date. You need to raise the issue to project stakeholders. How should you best communicate the problem to...
-
Andy and Marcia Tufts, both age 35, are married with two children and file a joint return. Assume the children do not qualify for the child tax credit (Ch. 9), and the mortgage is not over $750,000....
-
2. Wilt Chamberlain holds the record for the highest number of points scored in a single NBA basketball game. Chamberlain scored 100 points for Philadelphia against the New York Knicks on March 2,...
-
What is the relationship between combinations and Pascal's triangle?
-
Prove: \(\left(\begin{array}{l}n \\ r\end{array}ight)=\left(\begin{array}{c}n \\ n-r\end{array}ight)\)
-
For the system shown in Fig. D2.4, find \(k\) for which damping ratio of overall system is 0.7 . For this value of \(\mathrm{K}\) find undamped natural frequency. k 4 2 s + 12s + 2
-
For what values of ' \(a\) ' does the system shown in figure has a zero steady state error [i.e., \(\operatorname{Lim}_{t ightarrow \infty} e(t)\) ] for a step input: (a) \(a=0\) (b) \(a=1\) (c)...
-
The "Pick 3 " at horse racetracks requires that a person select the winning horse for three consecutive races. If the first race has nine entries, the second race eight entries, and the third race...
-
121. What is the appropriate protein portion for women? A.O2 palm portions B.O2 cupped handfuls C.O1 cupped handful D.01 palm portion 122. The need for different phases of training helps to prevent...
-
Drainee purchases direct materials each month. Its payment history shows that 65% is paid in the month of purchase with the remaining balance paid the month after purchase. Prepare a cash payment...
-
[The plaintiff, Bigelow-Sanford, Inc., contracted with defendant Gunny Corp. for the purchase of 100,000 linear yards of jute at $0.64 per yard. Gunny delivered 22,228 linear yards in January 1979....
-
The Supreme Court of State G decided that the United States Constitution requires professors to warn students of their right to remain silent before questioning the students about cheating. This...
-
Albert, Betty, and Carol own and operate the Roy Lumber Company, a limited liability partnership (LLP). Each contributed one-third of the capital, and they share equally in the profits and losses....
-
Frieda Wannamaker is a taxable investor who is currently in the 28% income-tax bracket. She is considering purchasing a tax-exempt bond with a yield of 3.75%. The taxable equivalent yield on this...
-
Holding constant all other variables and excluding any interactions among the determinants of value, which of the following would most likely increase a firms price-to-earnings multiple? a. The risk...
-
A rationale for the use of the price-to-sales (P/S) approach is: a. Sales are more volatile than earnings. b. P/S ratios assess cost structures accurately. c. Revenues are less subject to accounting...
Study smarter with the SolutionInn App