objects have the following
-attributes/ data
-behaviors/ operation
anytime a division is done you get a quotient and remainder in java.
Addition gives you an int back
subtraction gives you a int back
multiplication gives you a in back
% —Modulus
/ —Division
What are real numbers?
any rational or irrational number
integer division vs floating point division
late night talk do the operators have two different set of sequence for solving the same problem?
why yes they do completely different.
// example for 9-5-12 public class Example1 { public static void main ( String [] args ) { double a = 5.2665; double b = 2.3232; double result; result = a + b; System.out.printf("%.2f + %.2f = %.2f\n", a, b, result); result = a - b; System.out.printf("%.2f - %.2f = %.2f\n", a, b, result); result = a * b; System.out.printf("%.2f * %.2f = %.2f\n", a, b, result); result = a / b; System.out.printf("%.2f / %.2f = %.2f\n", a, b, result); result = a % b; System.out.printf("%.2f %% %.2f = %.2f\n", a, b, result); }// end of void main }//end of classs Example
repeat this ten times
<color=red>
“every expression has a value”
</color=red>
-variables are expressions
-formulas
var = var mathOperation expression
// class example2 for 9-5-12 public class Example1 { public static void main ( String [] args ) { double a = 5.2665; double b = 2.3232; double result = 1; result += a + b; System.out.printf("result = %.2f\n", result); result -= a - b; System.out.printf("result = %.2f\n", result); result *= a * b; System.out.printf("result = %.2f\n", result); result /= a / b; System.out.printf("result = %.2f\n", result); result %= a % b; System.out.printf("result = %.2f\n", result); }// end of void main }//end of classs Example
I always had a passion for the field of STEM (Science, Technology, Engineering, and Math) and I knew I wanted to do something to make a difference in the world. I just didn’t know where to start. I was an immigrant in a new country, grew up in a tough environment, and wasn’t sure how… Read More