******************SEP 7************************** ************************************************* Natural language Vs. Programming language If Syntax is correct, the output is uniquely determined. Semantics-meaning Input-process-output Ch 1.1-1.10 p1-23 Ch 2.1-2.10 p33-51 2.11-2.18 p69 Block- written between {} { Egyptian style } Comment // -why you are doing this Declare -int //whole numbers -double // number with a decimal points -boolean // can only be true or false -String // text, such as "Hello" -main // display a message doesn't return anything ****************SEP 12******************************** ****************************************************** Style 1 //// State Purpose //// Name Javadoc /** @author @result */ /** A simple Java program. (Liang p.12) **/ public class Welcome { public static void main( String args[] ) { // Main method: display a message. System.out.println( "Welcome to Java" ); } } = not equal, assign == equal A numeric expression may consist of: -Variables // with names such as radius -Constants // such as 3.14159 -infix // operators such as: + - * / % -Parentheses // ( to group subexpressions ) -pow(a,b) // a raise to the b power *n+=3 - n=n+3 n/ - n+n/3 4 P 3 E 2 MD 1 AS ****************SEP 14******************************** ****************************************************** POWER EXPRESSION class Main { public static void main(String[] args) { double result; int a = 2; int b = 4; result= (9.5*4.5-2.5*3)/(45.5-3.5) + Math.pow(a,b) ; System.out.print( "The result is: " ); System.out.println( result ); } } ****************SEP 19******************************** ****************************************************** class round{ public static void main(String args[]){ double a = 123.13698; double roundOff = (double) Math.round(a*100)/100; System.out.println(roundOff); } }