From ggc
|
01 packagepackage is used to name the directory or folder a class is in intro;
02
03 importimport means to make the classes and/or packages available in this program wiki.Wiki;
04
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 NumberExpressions
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 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)
12 {open braces start code blocks and must be matched with a close brace
13 doubledouble is the type for numbers that can contain decimal fractions c=this assignment operator makes the left side equal to the right side0.00034;
14 doubledouble is the type for numbers that can contain decimal fractions result=this assignment operator makes the left side equal to the right side-Math.log10(c);
15 intint is the type for whole numbers and it is short for integer rounded=this assignment operator makes the left side equal to the right side(intint is the type for whole numbers and it is short for integer)Math.round(result);// dont do (int)result because it truncates, not rounds
16 doubledouble is the type for numbers that can contain decimal fractions nearestTenth=this assignment operator makes the left side equal to the right sideMath.round(result*10)/10.0;
17 doubledouble is the type for numbers that can contain decimal fractions a=this assignment operator makes the left side equal to the right side3;
18 doubledouble is the type for numbers that can contain decimal fractions b=this assignment operator makes the left side equal to the right side4;
19 doubledouble is the type for numbers that can contain decimal fractions hypotenuse=this assignment operator makes the left side equal to the right sideMath.sqrt(a*a+adds two numbers together or concatenates Strings togetherb*b);//Math.sqrt(Math.pow(a, 2)+Math.pow(b, 2));
20 doubledouble is the type for numbers that can contain decimal fractions discriminant=this assignment operator makes the left side equal to the right sideb*b-4*a*c;
21 doubledouble is the type for numbers that can contain decimal fractions root1=this assignment operator makes the left side equal to the right side(-b+adds two numbers together or concatenates Strings togetherMath.sqrt(discriminant))/(2*a);
22 doubledouble is the type for numbers that can contain decimal fractions root2=this assignment operator makes the left side equal to the right side(-b-Math.sqrt(discriminant))/(2*a);
23 Wiki.out.println("The result is "+adds two numbers together or concatenates Strings togetherresult);
24 Wiki.out.println("The rounded result is "+adds two numbers together or concatenates Strings togetherrounded);
25 Wiki.out.println("The rounded to tenth result is "+adds two numbers together or concatenates Strings togethernearestTenth);
26 }close braces end code blocks and must match an earlier open brace
27 }close braces end code blocks and must match an earlier open brace
|
Download/View intro/NumberExpressions.java