CMIS 102A Math stuff needed for the course. 4 arithmetic operators: + - * / they must be used, there's no "4a" meaning "4 times a" like in algebra. 4*a the operator must be written. 4/a is "4 divided by a" The normal algebraic order of operations applies in Java. Parentheses override the normal order. In Java, if a number does not have a decimal point it is an integer. Division of integers is whole number division and there is no decimal point in the result: 7/2 is 3 (not 3.5) Integer division by zero isn't allowed. Evaluate these Java arithmetic expressions: (i.e. what's the answer) 7+5*3 7+5/3 7-5-3 7*5/3 7+5*3-2 7+5/3-2 7*5-3*2 7/5-3/2 7*5*3*2 7/5*3/2 7/5/3/2 7-5-3-2 (7+5)*3 7+(5*3) 7-(5-3) (7+5)*(3-2) 7+5*(3-2) 7+(5*(3-2)) //************************************************************* Pythagorean theorem: in a right triangle (one with a 90 degree angle), the length of the hypotenuse (the side opposite the right angle, and the longest side) is equal to the square root of the sum of the squares of the other two sides. What is the hypotenuse of the right triangles with the following side lengths? 3 and 4 6 and 8 3 and 3 1 and 1 //************************************************************* Circles: diameter is twice the radius (radius is half the diameter). PI is approximately 3.14159... (it's the ratio of the circumference to the diameter) circumference is 2 times the radius times PI area is radius squared times PI What are the circumference and area of these circles: radius 1 radius 2 diameter 20 //************************************************************* In a Cartesian x,y coordinate system (think graphing of functions etc) each point has an (x,y) coordinate. What are the four corner coordinates of a rectangle that is 200 wide and 300 tall whose lower left coordinate is at (0,0)? What is the coordinate of the center of the rectangle? What are the four corner coordinates of the rectangle that is half the size that is centered on the same center point as the outer rectangle? //************************************************************* Java has a fifth arithmetic operator: % which is the "mod" (short for modulus) operator. It's a remainder operator, the remainder after dividing: 7%2 equals 1, the remainder after dividing 7 by 2 (think about when you first learned division, "2 goes into 7 three whole times, with a remainder of 1"). This % operator has nothing to do with percent; some punctuation symbol was needed, and % does have a / in it, sort of like division. Mod by 0 isn't allowed. Evaluate: 5%5 5%4 5%3 5%2 5%1 5%0 5%6 To get the number of whole minutes in a large number of seconds, integer divide the seconds by 60 and mod it by 60 to get the remainder seconds. 320 seconds is how many minutes and seconds?