From ggc
|
01 packagepackage is used to name the directory or folder a class is in intermediate;
02
03 importimport means to make the classes and/or packages available in this program wiki.*;
04
05 publicpublic is used to indicate unrestricted access (any other class can have access) classclass is a group of fields and methods used for making objects DefiniteTest extendsextends means to customize or extend the functionality of a class DefiniteNumericCollectionTest
06 {open braces start code blocks and must be matched with a close brace
07 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value runTests(DefiniteNumericCollection collection)
08 {open braces start code blocks and must be matched with a close brace
09 trytry is for executing a code block that may experience exceptions (errors)
10 {open braces start code blocks and must be matched with a close brace
11 collection.clear();
12 Number number=this assignment operator makes the left side equal to the right sidecollection.getMedian();
13 ifif executes the next statement only if the condition in parenthesis evaluates to true(Double.isNaN(number.doubleValue()))
14 {open braces start code blocks and must be matched with a close brace
15 passed.add("Empty median test");
16 }close braces end code blocks and must match an earlier open brace
17 elseelse is what happens when the if condition is false
18 {open braces start code blocks and must be matched with a close brace
19 failed.add("Empty median test");
20 }close braces end code blocks and must match an earlier open brace
21 }close braces end code blocks and must match an earlier open brace
22 catchcatch means to handle an exception that may occur(Exception e)
23 {open braces start code blocks and must be matched with a close brace
24 failed.add("Empty median test:\n\t"+adds two numbers together or concatenates Strings togethere.getStackTrace());
25 }close braces end code blocks and must match an earlier open brace
26 trytry is for executing a code block that may experience exceptions (errors)
27 {open braces start code blocks and must be matched with a close brace
28 collection.clear();
29 Number number=this assignment operator makes the left side equal to the right sidecollection.getMin();
30 ifif executes the next statement only if the condition in parenthesis evaluates to true(Double.isNaN(number.doubleValue()))
31 {open braces start code blocks and must be matched with a close brace
32 passed.add("Empty min test");
33 }close braces end code blocks and must match an earlier open brace
34 elseelse is what happens when the if condition is false
35 {open braces start code blocks and must be matched with a close brace
36 failed.add("Empty min test");
37 }close braces end code blocks and must match an earlier open brace
38 }close braces end code blocks and must match an earlier open brace
39 catchcatch means to handle an exception that may occur(Exception e)
40 {open braces start code blocks and must be matched with a close brace
41 failed.add("Empty min test:\n\t"+adds two numbers together or concatenates Strings togethere.getStackTrace());
42 }close braces end code blocks and must match an earlier open brace
43
44 }close braces end code blocks and must match an earlier open brace
45
46 publicpublic is used to indicate unrestricted access (any other class can have access) staticstatic means that an instance is not required for access (class level access) voidvoid means the method does not return a value mainThe main method is the place where applications begin executing.(String[brackets are typically used to declare, initialize and index (indicate which element of) arrays]brackets are typically used to declare, initialize and index (indicate which element of) arrays args)
47 {open braces start code blocks and must be matched with a close brace
48 Wiki.out.println("Test coming here soon.");
49 DefiniteNumericCollection x=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor DefiniteImplementation();
50 DefiniteNumericCollection y=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor DefiniteImplementation();
51
52 DefiniteTest test=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor DefiniteTest();
53 DefiniteTest test2=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor DefiniteTest();
54 test.runTests(x);
55 Wiki.out.println("Passed report: ");
56 Wiki.out.println(test.getPassReport());
57 Wiki.out.println("Failed report: ");
58 Wiki.out.println(test.getFailReport());
59
60 }close braces end code blocks and must match an earlier open brace
61
62 }close braces end code blocks and must match an earlier open brace
|
Download/View intermediate/DefiniteTest.java