CS 111 - 9/3/15
Section 2.2 in the text discusses how to install the software.
Step 1: Install the JDK - Java Development Kit
Step 2: Download DrJava (or other Java IDE)
Step 3: Download the BookClasses Library
--------------------------
Integer Division vs. Floating Point Division
if both operands for a divsion operation are integer values/variables,
then integer division will occur
if at least one operand for a divsion operation are floating point values/variables,
then floating point division will occur
Integer Division is "long division with quotent and remainder"
Remember from grade school: 25 / 7 = 3 R 4
3 R 4
------
7 | 25
21
---
4
The 3 is the quotent from the above problem
The 4 is the remainder from the above problem
14 / 4 ==> 3 R 2
so
int x;
x = 14 / 4 ; // x will have 3 since integer division occured
double a;
a = 14.0 / 4.0 // a will have 3.5 since floating point division occured
--------------------------
Remainder from an integer division - Modulus
operator for modulus is %
int x;
int y;
int z;
int w;
x = 14;
y = 4;
z = x / y; // integer division ==> 3
w = x % y; // remainder/modulus result ==> 2