Lecture 3: I/O Investigation of Rational Numbers
Variables
Definition:
Value variable: A storage to hold only one value of the same type.
Type: a set of all values of the same characteristics.
Example 1: The variable Box holds one ball at a time from its type Balls
Example 2: The variable personAge holds one value 16, a member of the set Teens.
Assignment Symbol:
(
1. It is used to move a value on the right side into a variable on the left side of the symbol; The value must be a member of the variable type.
A ( 5;
2. It is used to move a value in a variable on the right side into a variable on the left side, for example A (B;
3. It is used to move the result of expression on the right side into a variable on the left side, for example A (B*2 +3;
How to declare a variable:
Reference variable: A storage to hold a reference (address) which leads to another storage which holds a value.
Example:
public class Rational
{
// Object Frame
int numerator;
int denominator;
// constructors
public Rational()
{ numerator = 0;
denominator = 1;}
public Rational(int num, int denom)
{numerator = num;
denominator = denom; }
// instance methods
public void printFraction()
{ System.out.println(numerator + "/" + denominator);}
}
-----------------------
14
Teens = {13,14,15,16,17,18,19}
personAge
Box
Balls = {Green, Orange, Purple}
13
15
17
18
16
19
16
13
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- rational numbers between fraction calculator
- rational numbers operations worksheet pdf
- operations with rational numbers pdf
- rational numbers to decimal expansion calculator
- repeating decimals to rational numbers calculator
- rational numbers least to greatest calculator
- put rational numbers in order calculator
- multiply rational numbers calculator
- identify rational numbers worksheet
- operations with rational numbers worksheet
- fractions rational numbers calculator
- rational numbers answer key