Lecture 6, CS 302-7 and 8, February 3
i. Operand
ii. Operator
i. 3/2=1
ii. 3.0/2=1.5
i. Math.pow(a,b); //a^b
ii. Math.sqrt(a); //sqrt(a)
iii. Squared - Might be easier just to do x * x
iv. Can use Math.pow to do cube root, cube, etc
i. Like standard math
ii. ()
iii. Will discuss more once we introduce a few more operators
i.
pseudorandom
vs random
1. True randomness: hotbits - http://www.fourmilab.ch/hotbits/
i. Seed - > new Random(a);
i. Returns an int between 0 and a (exclusive)
1. So, .nextInt(4) can return 0,1,2, or 3
i. returns any int in range (-2,147,483,648 to 2,147,483,648)
i. returns a double between 0.0 and 1.0
i. ab
ii. c
iii. 1
iv. &
i. Name is variable, Rob is literal
i. name.length()
i. String empty=;
ii. empty.length(); // 0
i. Like addition, for Strings
ii. String x=x;
iii. String y=y;
iv.
String
z=x+y;
v.
S.o.p(z);
//xy
1. (S.o.p is shorthand for System.out.println() you still have to write it out in your programs)