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.Wiki;
04 importimport means to make the classes and/or packages available in this program java.util.*;
05 /**
06 * All about my application.
07 * @authorthis is the Javadoc tag for documenting who created the source code My Name Here
08 */
09 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 ParametersAndReturn
10 {open braces start code blocks and must be matched with a close brace
11 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 getRoot1()
12 {open braces start code blocks and must be matched with a close brace
13 Scanner scanner=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor Scanner(Wiki.in);
14 Wiki.out.print("Enter in a: ");
15 doubledouble is the type for numbers that can contain decimal fractions a=this assignment operator makes the left side equal to the right sidescanner.nextDouble();
16 Wiki.out.print("Enter in b: ");
17 doubledouble is the type for numbers that can contain decimal fractions b=this assignment operator makes the left side equal to the right sidescanner.nextDouble();
18 Wiki.out.print("Enter in c: ");
19 doubledouble is the type for numbers that can contain decimal fractions c=this assignment operator makes the left side equal to the right sidescanner.nextDouble();
20 ifif executes the next statement only if the condition in parenthesis evaluates to true(b*b-4*a*c>0)
21 {open braces start code blocks and must be matched with a close brace
22 doubledouble is the type for numbers that can contain decimal fractions root=this assignment operator makes the left side equal to the right side(-b+adds two numbers together or concatenates Strings togetherMath.sqrt(b*b-4*a*c))/(2*a);
23 Wiki.out.println("The first root is "+adds two numbers together or concatenates Strings togetherroot);
24 }close braces end code blocks and must match an earlier open brace
25 elseelse is what happens when the if condition is false
26 {open braces start code blocks and must be matched with a close brace
27 Wiki.out.println("Keep dreaming, it's imaginary.");
28 }close braces end code blocks and must match an earlier open brace
29 }close braces end code blocks and must match an earlier open brace
30
31 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 getRoot2()
32 {open braces start code blocks and must be matched with a close brace
33 Scanner scanner=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor Scanner(Wiki.in);
34 Wiki.out.print("Enter in a: ");
35 doubledouble is the type for numbers that can contain decimal fractions a=this assignment operator makes the left side equal to the right sidescanner.nextDouble();
36 Wiki.out.print("Enter in b: ");
37 doubledouble is the type for numbers that can contain decimal fractions b=this assignment operator makes the left side equal to the right sidescanner.nextDouble();
38 Wiki.out.print("Enter in c: ");
39 doubledouble is the type for numbers that can contain decimal fractions c=this assignment operator makes the left side equal to the right sidescanner.nextDouble();
40 ifif executes the next statement only if the condition in parenthesis evaluates to true(b*b-4*a*c>0)
41 {open braces start code blocks and must be matched with a close brace
42 doubledouble is the type for numbers that can contain decimal fractions root=this assignment operator makes the left side equal to the right side(-b-Math.sqrt(b*b-4*a*c))/(2*a);
43 Wiki.out.println("The first root is "+adds two numbers together or concatenates Strings togetherroot);
44 }close braces end code blocks and must match an earlier open brace
45 elseelse is what happens when the if condition is false
46 {open braces start code blocks and must be matched with a close brace
47 Wiki.out.println("Keep dreaming, it's imaginary.");
48 }close braces end code blocks and must match an earlier open brace
49 }close braces end code blocks and must match an earlier open brace
50
51 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) doubledouble is the type for numbers that can contain decimal fractions getRoot2(doubledouble is the type for numbers that can contain decimal fractions a, doubledouble is the type for numbers that can contain decimal fractions b, doubledouble is the type for numbers that can contain decimal fractions c)
52 {open braces start code blocks and must be matched with a close brace
53 ifif executes the next statement only if the condition in parenthesis evaluates to true(b*b-4*a*c>0)
54 {open braces start code blocks and must be matched with a close brace
55 returnreturn means to provide the result of the method and/or cease execution of the method immediately (-b-Math.sqrt(b*b-4*a*c))/(2*a);
56 }close braces end code blocks and must match an earlier open brace
57 elseelse is what happens when the if condition is false
58 {open braces start code blocks and must be matched with a close brace
59 returnreturn means to provide the result of the method and/or cease execution of the method immediately Double.NaN;
60 }close braces end code blocks and must match an earlier open brace
61 }close braces end code blocks and must match an earlier open brace
62
63 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) doubledouble is the type for numbers that can contain decimal fractions getRoot1(doubledouble is the type for numbers that can contain decimal fractions a, doubledouble is the type for numbers that can contain decimal fractions b, doubledouble is the type for numbers that can contain decimal fractions c)
64 {open braces start code blocks and must be matched with a close brace
65 ifif executes the next statement only if the condition in parenthesis evaluates to true(b*b-4*a*c>0)
66 {open braces start code blocks and must be matched with a close brace
67 returnreturn means to provide the result of the method and/or cease execution of the method immediately (-b+adds two numbers together or concatenates Strings togetherMath.sqrt(b*b-4*a*c))/(2*a);
68 }close braces end code blocks and must match an earlier open brace
69 elseelse is what happens when the if condition is false
70 {open braces start code blocks and must be matched with a close brace
71 returnreturn means to provide the result of the method and/or cease execution of the method immediately Double.NaN;
72 }close braces end code blocks and must match an earlier open brace
73 }close braces end code blocks and must match an earlier open brace
74
75 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)
76 {open braces start code blocks and must be matched with a close brace
77 Scanner scanner=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor Scanner(Wiki.in);
78 Wiki.out.print("Enter in a: ");
79 doubledouble is the type for numbers that can contain decimal fractions a=this assignment operator makes the left side equal to the right sidescanner.nextDouble();
80 Wiki.out.print("Enter in b: ");
81 doubledouble is the type for numbers that can contain decimal fractions b=this assignment operator makes the left side equal to the right sidescanner.nextDouble();
82 Wiki.out.print("Enter in c: ");
83 doubledouble is the type for numbers that can contain decimal fractions c=this assignment operator makes the left side equal to the right sidescanner.nextDouble();
84 Wiki.out.println("Root 1 is "+adds two numbers together or concatenates Strings togethergetRoot1(a, b, c));
85 Wiki.out.println("Root 2 is "+adds two numbers together or concatenates Strings togethergetRoot2(a, b, c));
86 doubledouble is the type for numbers that can contain decimal fractions vertex=this assignment operator makes the left side equal to the right side(getRoot1(a, b, c)+adds two numbers together or concatenates Strings togethergetRoot2(a, b, c))/2;
87 Wiki.out.println("Vertex is "+adds two numbers together or concatenates Strings togethervertex);
88 }close braces end code blocks and must match an earlier open brace
89 }close braces end code blocks and must match an earlier open brace
|
Download/View intermediate/ParametersAndReturn.java