From ggc
|
01 packagepackage is used to name the directory or folder a class is in intermediate;
02
03
04 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 MyDefiniteNumericCollection
05 implementsimplements means providing method bodies for the methods declared in the corresponding interface DefiniteNumericCollection
06 {open braces start code blocks and must be matched with a close brace
07
08 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value add(Number number)
09 {open braces start code blocks and must be matched with a close brace
10 // TODO Auto-generated method stub
11
12 }close braces end code blocks and must match an earlier open brace
13
14 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value clear()
15 {open braces start code blocks and must be matched with a close brace
16 // TODO Auto-generated method stub
17
18 }close braces end code blocks and must match an earlier open brace
19
20 publicpublic is used to indicate unrestricted access (any other class can have access) Number getAverage()
21 {open braces start code blocks and must be matched with a close brace
22 // TODO Auto-generated method stub
23 returnreturn means to provide the result of the method and/or cease execution of the method immediately nullnull is the value used to refer to a non-existant object;//Double.NaN;
24 }close braces end code blocks and must match an earlier open brace
25
26 publicpublic is used to indicate unrestricted access (any other class can have access) Number getMax()
27 {open braces start code blocks and must be matched with a close brace
28 // TODO Auto-generated method stub
29 returnreturn means to provide the result of the method and/or cease execution of the method immediately nullnull is the value used to refer to a non-existant object;
30 }close braces end code blocks and must match an earlier open brace
31
32 publicpublic is used to indicate unrestricted access (any other class can have access) Number getMedian()
33 {open braces start code blocks and must be matched with a close brace
34 // TODO Auto-generated method stub
35 returnreturn means to provide the result of the method and/or cease execution of the method immediately nullnull is the value used to refer to a non-existant object;
36 }close braces end code blocks and must match an earlier open brace
37
38 publicpublic is used to indicate unrestricted access (any other class can have access) Number getMin()
39 {open braces start code blocks and must be matched with a close brace
40 // TODO Auto-generated method stub
41 returnreturn means to provide the result of the method and/or cease execution of the method immediately nullnull is the value used to refer to a non-existant object;
42 }close braces end code blocks and must match an earlier open brace
43
44 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value remove(Number number)
45 {open braces start code blocks and must be matched with a close brace
46 // TODO Auto-generated method stub
47
48 }close braces end code blocks and must match an earlier open brace
49
50 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)
51 {open braces start code blocks and must be matched with a close brace
52 MyDefiniteNumericCollection mine=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor MyDefiniteNumericCollection();
53 mine.add(5.6);
54 mine.add(7.7);
55 System.out.println("The average is "+adds two numbers together or concatenates Strings togethermine.getAverage());
56 }close braces end code blocks and must match an earlier open brace
57
58 }close braces end code blocks and must match an earlier open brace
|
Download/View intermediate/MyDefiniteNumericCollection.java