0% found this document useful (0 votes)
6 views

Computer Application Update

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Computer Application Update

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

COMPUTER APPLICATION

CHAPTER – I
INTRODUCTION TO OBJECT ORIENTED PROGRAMMING
Programming language:- The sequence of set of instruction of any programmng language
used to find the solution of a problem is known as programming language. The programming
language are commonly divided into two parts:

System Programming Language:- These programming languages are used to write system
program or system software or an operating system.

Application Programming Language:- These programming language are used to write a


programs related to specific area as well as creates customized software such as inventory
control, payroll processing, banking system control, tax processing etc.

Introduction to Object – Oriented Programming( OOP)

The Object – Oriented programming is a programming methodology that helps to organize set
of instruction in a proper sequence to develop program or software.

Advantages:

It implements code Reuse and Recycling concept; which means the objects created for Object
Oriented Programs can easily be reused in other programs.

Categorized as:

i) Procedure Oriented Programming:- The programming language which contains step


by step procedure to execute is known as Procedure Oriented Programming ( POP).
E.g. COBOL, Fortran, Visual Basic, Pascal and C.
ii) Object Oriented Programming:- It is programming language in which data and
functions are wrapped into a single unit.

What is an object?
An identifiableentity with some characteristics, a state and behavior is known as an Object.

OR
An object is self – contained entity that contains attributes and behavior. The object can be
an item, place, person or any other entity.

Example:-
. Red, Green, Yellow, Blue etc.

. Banana, Apple, Grapes etc.

What is class?

A class can be a blue print or template of thought for multiple objects with similar feature. It
is a collection of similar type of objects.

Example:-

 Fruits is the class where Banana, Apple, Grapes are object.


 Color is the class where Yellow, Red, Blue, Green are object.

Characteristics of Object

i) Identity:- The name by which an object is recognized is known as identity. E.g. pen,
laptop, CD etc.
ii) State:- It refers to whether an object is in processed or unprocessed state. E.g.
computer may be in any state : On state, Off state, Out of order state.
iii) Behavior:- This refers that what an object is capable of doing.

Principles of Object – Oriented Programming

i) Abstraction ( Data Abstraction ):- The act of representing the essential features of an
object without knowing its background details.
Example :- We only are pressing certain switches according to our requirement, what
is happening inside, how it is happening etc. we not know.
Data Hiding: The property which does not allow the data and its function to be used
as public interface is known as data hiding ( or information hiding ).
ii) Encapsulation: The wrapping up of data and methods into a single unit is known as
Encapsulation. Example, The TV is considered as single unit that encapsulate many
program.
iii) Inheritance:- The act of process of acquiring the properties from an existing class by
another class is known as Inheritance.

Base class:- The existing class whose properties are inherited by some other class is known as
Base class or Supper class or Parent class.

Derived class:- The class that acquires the properties from existing class is Derived class or sub
class or child class.
A

Advantages of Inheritance:-

 Reusability of the program


 It saves computer main memory
 It avoid repetition of writing
 It reduce execution time

Polymorphism:- More than one function with same name and unique parameter when present in
a same class is known as function overloading. Such concept is known as Polymorphism.

TABLE

Dining Table Center Table Study Table Computer Table


1. Why class is known as object factory?
Each class describes possibly an infinite set of individual objects. So, it can be called a
factory of object. E.g. a class of cellphone can have numerous objects as Nokia,
Samsung, Panasonic etc. The features and functions of the objects are described within
the class.
2. Define an encapsulation?
The wrapping up of data and methods into a single unit is known as Encapsulation.
Example, The TV is considered as single unit that encapsulate many program.
3. Using an example, explain the term object?

An object is self – contained entity that contains attributes and behavior. The object can be
an item, place, person or any other entity.

Example:-

. Red, Green, Yellow, Blue etc.

. Banana, Apple, Grapes etc.

4. Explain function overloading with an example.


More than one function with same name and unique parameter when present in a same
class is known as function overloading.
class DBCC
{
public void area(int l, int b)
{
intar = l*b;
System.out.println(ar);
}
public void area( int l)
{
intar = l*l;
System.out.println(ar);
}
public void area( double l)
{
double ar=3.1412*(l*l);
System.out.println(ar);

}
}

5. Which OOP principle implements function overloading?


Polymorphism concept implements function overloading.
6. What is inheritance and how is it useful in java?
Inheritance:- The act of process of acquiring the properties from an existing class by
another class is known as Inheritance.
Advantages of Inheritance:-

 Reusability of the program


 It saves computer main memory
 It avoid repetition of writing
 It reduce execution time
7. Difference between base class and derived class?
Base class:- The existing class whose properties are inherited by some other class is
known as Base class or Supper class or Parent class.
Derived class:- The class that acquires the properties from existing class is Derived class
or sub class or child class.

CHAPTER -2
INTRODUCTION TO JAVA
Java environment has a number of development tools hundred of libraries. All the
development tools are the part of system known as Java Development Kit ( J. D. K.).
APPLICATION PROGRAMMING INTERFACE:-
Classes and methods are the part of Java Standard Library (J. S. L.), which are also called
Application Programming Interface( A. P. I.).

Types of Java Program:-

Applet program:- The Java applets that runs within a web browser. These are mainly used for
internet programming. An applet is capable of performing many task on a web page. Applets
are also used to create animation, displaying graphics, playing sounds, accepting user input
and interactive games.

Stand Alone Application:- A stand- alone application refers to a Java program that can run
independently on a computer.

Byte Code:- The Java program are both compiled and interpreted. The compiler translates the
source code to an intermediate level language called Byte Code. It is independent of the
machine on which the program runs. The byte code file can be used any system.

JAVA VIRTUAL MACHINE( J. V. M.):-

The Java run-time system or virtual machines that translates or interprets byte code into
machine code is known as Java Virtual Machine.

Source Code:- The set of instruction and statements written by computer programmer using a
programming language to find the solution of a problem is known as source code or program.
Object code :- The machine language program produced after the compilation of the source
code is known as Object Code.

Characteristics of Java
Platform Independent:- It is a platform independent language which means the change of
environment or platform, the Java program will not be affected.

Write Once Run Anywhere(W. O. R. A):- It means the program written in Java can be
successfully executed in platform without any change.

Object Oriented Language:- It support OOP concept i.e. Data Abstraction, Encapsulation,
Inheritance and Polymorphism. Which enables easier and convenient program development.

Simple Coding:- The Java coding is simple which does not require complex instruction.

User Friendly Envornment:- It can also be used by the novice user with fundamental
programming concept.

Java is Robust:- The Java has features of automatically memory management and garbage
collection along with strong exception handling mechanism that makes it Java Robust.

Secure Environment:- The Java language supports many strong in – built security features
that makes the system secure from crash.

Types of Errors:-
Syntax Error:- Violation of any grammatical rules causes syntax error and it is also known as
compilation error.

Run Time Errors:- The runtime errors occurs during execution of program. The runtimes are :
Dividing a number by zero, Array index out of bound, Arithmetic error like square root of
negative number, range errors and other input errors.

Logical Errors:- Logical error are the result of wrong logic of program. For example, if the
problem is to calculate sum of two numbers instead of it gives product of two numbers.

blueJ I.D.E.(Integrated Development Environment:-


blueJ is called an Inetegrated Development Environment. It puts together the features of an
editor, a debugger and a viewer.

Most common IDE

1. blueJ 2. Visual basic etc.


CHAPTER -3
JAVA TOKENS, CONSTANT, VARIABLES AND DATA TYPE
Java Character Set:- The set of valid character that a language can recognize is known
as character set.
Unicode Character set:- A 16 – bit character code set that encode characters used in the
language is known as Unicode Character Set.
Java Tokens:- The smallest individual entity in a program to perform operations is
known as a token. Java token are divided into five categories:
1. Keywords:- The words that convey some special meaning to the java compiler are
known as keywords.
abstract super native false
Case throws private for
Continue void synchronized int
else boolean switch new
finally catch transient protected
implements default while short
long extends break this
package float char true
return import do IOException
byte class double final
if interface null public
static throw try

2. Identifiers:- Identifiers are fundamental building blocks of a program and are used to
name different components of a program. E.g. name of function, variables, class,
object etc.
Rules for naming Identifier:
i) An identifier can consists of any combination of letters, digits,
underscore character, dollar sign($).
ii) An identifier cannot begin with a digit.
iii) Identifiers can be of any length.
iv) Uppercase and lowercase will be treated distinctly
v) It should not be keyword.

Find out valid identifiers and if it is invalid give reason:

i) Student_name ii) this iii) total-marks


iv) $M1english v) 3math vi) _Age
vii) TOTAL viii) this_is_a_very_long_identifier ix) Total Amount
x) *number
3) Literals / constant:- The entity which do not change in the program is known as literal or
constant.
Category of literals
LITERALS

Numeric Non Numeric Boolean Null

Integer Real Character String

Numeric literals:-
Integer Literals:- Integer literals are value, which represent whole numbers only. They can be
positive or negative values. The integer value that contains no sign represent a positive value by
default.
Rules:-
 Comma not allowed
 Spaces not allowed
 No other character are allowed

From following find out which are valid and which are invalid Integer constant. If invalid,
write why?

a) 123 b) -356 c) 456 -


d) 0 e) 654321 f) 15 750
g) 20,100 h) Rs. 340 i) $ 639
j) 50.75
Real Literals:- Real literals are also called floating point literals as they represent values with
a decimal point. These can be written either in fractional or exponential form. It is possible that
the number may not have digits before or after decimal point. They can be positive or negative
values.

From following find out which are valid and which are invalid real constant. If invalid, give
the reason:

a) 0.0083 b) -0.775 c) 435.36


d) 215. e) .95 f) -.71
g) 13,536.05 h) 132
Mantissa and exponent:- A real literal in the exponent form consist of two components:
mantissa and exponent.
For example 1.02 x 1023 can be written in the exponent form as 1.02E23.
1.02 is the mantissa ( component before E )

23 is the exponent ( component after E )

E23 is represent 1023

From following find out which are valid and which are invalid exponent form. If invalid,
write why:

a) 12.E4 b) 12.3E c) 12.3 E 2.3


d) 450E4 e) 12,12E2 f) – 6.700E23
g) 152E+8
Non numeric literals:-
Character Literal:- A character literals represent exactly one character inside single quotes.
e.g. ‘k’, ‘@’, ‘6’
Escape Sequence:- the character constant which begin with backslash( ‘ \ ’ ) followed by one
letter that reflects the corresponding output during execution of code or program is known as
escape sequence.
\n New line – shifts the control to the new or next line.
\t Horizontal tab – behaves like tab key
\b Backspace – moves the cursor one space towards left.
\r Carriage return or enter – behaves like enter key.
\a Alarm or Alert – produces a beep sound or alert.
\’ Single quote – inserts a dash character in the output.
\” Double quote – insert a character “ in the output.
\? A question mark.
\On Represent an Octal Number ( O – Octal and n – number )
\xHn Represent Hexadecimal number (Hn – Hexadecimal number
\\ Back slash – insert a back slash character( \ ) in the output
\0 Null character ( represent end of line )
\uHn Unicode character.
String Literals:- One or more character enclosed inside double quotes are string literals
“Rourkela”, “X”, “9861077394”, “ Baby\’s day out”
Boolean literal:- The logical values true and false are the Boolean literals.
4. Punctuators / separators:- Punctuator are symbolic used for grouping and separating the
code.
Punctuators Name Purpose
() parenthesis Parenthesis or round brackets are used to define method.
They are also used to define precedence of operators in an
expression. In addition to this, they are also used to define
condition in control structure.
{} Curley braces Curley bracket are used in define a block of code in a java
program. They are also used to initialize the values of arrays.
[] Square bracket Square brackets are used to declare arrays and refers to
values at a particular index.
; Semi colon The most commonly used separator in Java is the semicolon.
It used to separate statements.
, comma It is used to separate consecutive identifiers in a variable
deceleration.
. Period The period operators in Java is used to access members
variables and methods. It is also used in differentiate the
package names from sub packages and class names.

Data type:- To identify the type of the data involved in an operation is known as data type.
OR
The means to recognize or identify an entity / entities and their operations are known as data
type.
TYPES OF DATA TYPES
.i. Primitive /Intrinsic / Built – in / Fundamental / Basic Data Type

.ii. Non Primitive / Extrinsic / Derived / Referenced Data Type

Primitive Data Type:- The fundamental data types that are an integral part of the Java
programming language are called Primitive data type.
The primitive data types can be grouped into the following four categories:
Integer Data Type:- Integer data type are used to store whole numbers. For example 345, -323,
1000. There are further four types of integers in Java. These are byte, short, int and long. The
values that can be stored in these depends on which data type is being used in the program.
Type Size in bits Size in byte Range
byte 8 bits 1 byte -128 to 127
short 16 bits 2 bytes -32,768 to 32,767
( - 215 to 215 – 1)
int 32 bits 4 bytes -2 billion to +2 billion ( approx)
-231 to 231 – 1
long 64 bits 8 bytes - 9 E 18 to + 9 E 18 ( approx )
-263 to 263 - 1
Floating point Data Type:- The floating point data type are used to store fractional number i.e.
numbers with decimal values. Floating point data types can be further divided into float and
double data type.
Type Size in bits Size in bytes Range
float 32 bits 4 bytes 3.4 E -38 to 3.4 E +38
Upto 7 significant decimal digits
double 64 bits 8 bytes 1.7 E -308 to 1.7 E +308
Upto 15 significant decimal digits
Character Data type:- In Java, characters are stored using char data types. This data types
supports the Unicode character set. The character data type occupies 2 bytes ( 16 bits ) in the
memory.
Boolean Data type:- The boolean data types is used for logical values. There are only two
values a boolean data type can have true or false. It occupies 1 byte ( 8 bits ) in the memory.

 Although a Boolean data type needs only one bit of storage, the java compiler reserves 8
bits = 1 byte for it.

Non Primitive Data Type:- The data types that are derived from the primitive types are called
non – primitive types. They are also known as reference types, derived types or composite data
types. There are three non-primitive types in Java: classes, arrays and interfaces.

Variables:- A variable is an identifier that denotes a location in computer’s memory to store a


data value.
OR
An entity which may vary during the program execution and denotes a storage location in the
memory to store a data value or constant or literal is known as variable.
Syntax :- data_type variable_name1, variable_name2, ----------------;

Variables Initialzation:-

Variables Initialization at the time of decleration


int sum = 0;
double avg=12.56;
Variables Initialization separetly
int sum;
sum = 0;
double a;
a = 5.6;
Default value of variables

Data type Default value


byte 0
short 0
int 0
long 0L
float 0.0f
double 0.0d
char ‘\u0000’
boolean false
Non Primitive or null
Reference data type

Symbolic Constant:- The final keyword is used to convert a variable and its value into
constant. It is known as symbolic constant.
Syntax:-
Final data_type variable= literals or value;
e.g. final float PI= 3.1412;
Type conversion:- It’s a process that converts a value of one data type to another data type.
There are two forms of Type Conversion in Java : Implicit and Explicit Conversion.
Implicit Type Conversion:- The conversion performed by Java compiler to convert data type is
known as Implicit Type Conversion or Automatic Type Conversion or Coercion or Type
promotion. The Java compiler generally converts all operand on the basis of data type of
largest operands.
Example:- Suppose there are following variables:
byte b; int a,c; float f, g, h; double d, e;
Assume that expression e = ( a + b ) * ( c – g ) – ( f + h ) – d is to be evaluated
e=( a + b ) *( c - g ) - ( f + h ) - d
int byte int float float float
int float float double
float
float

double
Explicit Type Conversion:- The process of converting an operand to the user defined data type
is known as Type Casting or Explicit Type Conversion. In other word force fully conversion of
one data type to another is known as Explicit type conversion
Eg. int x=68;
char ch = ( char ) x;
OPERATORS AND EXPRESSION:-
Expression:- An expression in Java is any valid combination of operators, constant and
variables i.e. legal combination.
Operators:- An operator is a symbol that tells the computer to perform certain mathematical or
logical manipulation. Operators are used in program to manipulate data and variables. They
usually form a part of mathematical or logical expression.
Types Of Operator:-
1. Arithmetic operator
2. Relational operator
3. Logical operator
4. Assignment operator
5. Increment and Decrement operator
6. Conditional operator
7. Bitwise operator
8. Special operator

Arithmetic operator
There are five arithmetic operator:-
+ Addition
- Subtraction
* Multiplication
/ Division
% Modulo division ( to get remainder )

Example
i. a + b .ii) a - b .iv) a * b/5 .iv) a % b

Precedence of Arithmetic operators:-


An arithmetic expression without any parenthesis will be evaluated from left to right using the
rules of precedence of operators. There are two distinct priority levels of arithmetic operators
in Java.
1. High priority: *, /, %
2. Low priority: +, -

Example: Find the value of x:

.i) x = a – b / 3 + c * 2 – 1

.ii) x = a – b / ( 3 + c ) * ( 2 – 1 )
Where a = 9, b = 12 and c = 3

Write the Java expression for the following algebraic expression:-

a) a b – c
b) ( m + n ) ( x + y )
ab
c)
𝑐
a
d)
𝑏𝑐
e) 3 x2 + 2 x + 1
x
f) + c
𝑦

Types of arithmetic
1. Integer Arithmetic
2. Real Arithmetic
3. Mixed – Mode Arithmetic
Integer Arithmetic:- In an expression when all the operands are of integer
types, the expression is called and integer expression and the operation is called
integer arithmetic. Integer arithmetic always gives an integer values.
Suppose a and b are integer with a = 14 and b = 4 then we have the following
results:
a – b = 10 a + b = 18 a * b = 56 a/b=3 a%b=2

Note:- For modulo division the sign of the result is always the sign of
numerator.
- 14 % 3 = - 2 - 14 % ( -3 ) = - 2 14 % ( - 3 ) = 2
Real Arithmetic:- In an expression when all the operands are of real types, the
expression is known as real arithmetic. It always gives a real value.
Suppose value of a and b are double type with a = 20.5 and b = 6.4

a + b = 26.9 a – b =14.1 a * b = 131.20 a / b = 3.20312 a % b = 1.3


Mixed Mode Arithmetic:- When some of the operands are real and some are
integer, such expression is known as mixed mode arithmetic expression. Such
case all the operands will be converted to real type and then real arithmetic will
be performed. The result will be a real.
From following find out what type of Arithmetic it is and explain it. Give the output:

1. ½ * 10 * 20
2. 1.0 /2 * 10 * 20
3. 1 / 2.0 * 10 * 20
4. 0.5 * 10.0 * 20.0
5. 15 /10
6. 15/ 10.0
7. 15.0/ 10.0

Relational Expression:- Two operands with a relational operator makes a relational


expression. It always gives boolean values.

Syntax:-

Value Value
Or Or
Variable Relational Operator Variable
Or Or
Arithmetic expression Arithmetic expression

Relational Operator:

< Is less than


<= Is less than or equal to
> Is greater than
>= Is greater than equal to
== Is equal to
!= Is not equal to

Logical Expression:- Two or more relational expression with logical operators make a logical
expression. Logical expression always gives boolean values.

Syntax:-

Relational Expression Logical Operator Relational Expression


Logical Operator

&& AND
|| OR
! NOT
State the output of the following:

a) 7 > 5 || 5 > 7
b) 5 + 3 > 7 || 7 > = 4 + 3
c) 3 = = 5 && 5 = = 5
d) 3 > 1 || 0 < - 5

Assignment Operator:- Assignment operator = to assign one value to another

int x, y, z;
x = 9;
y = 7;
z = x + y;
Short hand assignment operator:-

Java offers special short hand that simplify the coding of a certain type of assignment
statement.

Example a = a + 10; can be written a += 10;

Short hand Operator Use Equivalent to


+= op1+= op2 op1 = op1 + op2
-= op1 -= op2 op1 = op1 – op2
*= op1 *= op2 op1 = op1* op2
/= op1 /= op2 op1 = op1 / op2
Write short cut Java expression for each of the following

1. p = p + d 2. c = c - 20 3. t = t * 0.5 4. d = d / 10 5. e = e / 2

Increment and Decrement Operator:-

++ It adds 1 to its operand


-- It subtract 1 to its operand
Prefix :- the prefix increment or decrement operators follow change – then – use rule i.e.
they first change the value of their operands, then use the new value in evaluating
expression.
e. g. ++a + 4 if a = 2
it will change the value of a first because ++ sign is before a so
3+4
=7
Similarly --a + 4 if a = 2
It will change the value of a first because – sign is before a so
1+4
=5
Postfix:- the postfix increment or decrement operator follow use – then – change rule i.e.
they first use the value of their operand in evaluating the expression and then change.
e. g. a++ + 4 if a = 2
first its old value will be used and then it will change its own value
2 +4
=6 but the value of a is 3

Give the result of the following expression:


a) ++ a + a++ + 4; if a = 2
b) a- - + ( ++a) %4; if a = 5
c) 3 * ( a++) + ( ++a ) * 4; if a = 2
d) (( a++ ) * ( ++a )) / 5; if a = 5
e) (( a++ ) + ( ++a )) / ( a + 3 ); if a = 3

Conditional Operator:- Conditional assignment operator is also referred as ternary operator.


In this process, the assignment of the values are based on a condition.

e. g. c = ( a > b ) ? a : b;

In this statement, the value of a is assigned to c only if the given condition is true, otherwise b.

Nested Ternary Operator:- Ternary operator within ternary operator is known as nested
ternary operator.

Give the output of the following:-

a) Total = ( val + 500 ) > 1500 ? 200 : 400;


.i) val = 1000 .ii) val = 1500 initially
b) Boolean val = ( amt > 5000 ) ? true : false;
.i) amt = 3000 .ii) amt = 8000
c) int tax = ( amt > 100000 ) ? 5/100 * amt : 0
.i) amt = 50000 .ii) amt = 150000 .iii) amt = 105000 .iv) amt = 95000
Precedence of Operator:- The order in which the operators would be evaluated in an
expression is called precedence of operators. When the operator in an expression has similar
precedence than the rule of associativity determines the execution order of the expression.

Pritority Operator Operation Associativity


1 [] Array indix
() Method call left
. Member access
2 ++ Prefix or Postfix increment
-- Prefix or Postfix decrement
+, - Unary plus, minus
! Logical not
( type ) Type cast operator
new Object creation
3 *, /, % Multiplication, division, Modulo
division
4 +, - Addition, substraction
+ String concatenation
5 <, ,= Less than or less than equal to
>, >= Greater than or greater than
equal to
6 == Equal to
!= Not equal to
7 && Logical AND
8 || Logical OR
9 ?: Conditional operator Right
10 = Assignment operator Right
11 +=, -=, *=, /=, Short hand assignment operator Right
%=

What would be the output of each of the following :-

a) if int a = 5, b = 3, the value of c would be


i. int c = a + b * 7 / 2; ii. float c = a – b / 2 * 9 / 4;
iii. boolean c = 5 * 3 > a iv. boolean c = 5 + 3 / 4 >10 && 10 *2 / 5
b) If int p= 5 , q = 4, the value of r would be
i. r = ++ p + q++ + q- -; ii. r = p + 1 + q++ + ++p/++q;
iii. r = p / q + -- q / q++; iv. r = p * q + p + 2 / q -1 + p++;
c) Take a =3 and y =10 initially and solve the following and find the value of a and y:
i. y = a++ - --a + 5; ii. y = ++ a - ++a + a++ - 7;
iii. y += a-- + a-- + a-- - ++a + ++a; iv. y -= a-- + --a;
v. y *= ++a – 2; vi. y /= ++a;
vii. y %= ++a; viii. a += a-- + a-- + a-- + ++a + ++a;
ix. a -= a-- + --a; x. a *= ++a – 2;
xi. a /= ++a + ++a – 9; xii. a %= ++a – a--;
d) Evaluate the following expression, if the values of the variables are a=2, b=3 and c=9
i. a – ( b++ ) * ( --c);
ii. a * ( ++b ) % c;
e) what will be the result stored in x after evaluation the following expression:
int x = 4;
x+= ( x++ ) + ( ++x ) + x;
f) Operators with higher precedence are evaluated before operators with relatively lower
precedence. Arrange the operators given below in order of higher precedence to lower
precedence.
i. && ii. % iii. >= iv. ++
g) Give the data type of the following expression. Also indicates the type of conversion
taking place in it.
a) int a; char c; byte b;
a + c / b;
b) char c; float f; double d;
c * f / d;
c) int i, j; float f; double d;

( int ) ( i + f ) / ( j * d );

d) int x; char y; float z;


z * ( x + y );
e) double d; float a; char b;
( int ) d * b + a;
Methods in Math class:-
Function name Argument Return type Description
sqrt() double double Returns square root of double type value for
of given number passed as argument.
cbrt() double double Returns cube root of double type value for
of given number passed as argument.
pow() double, double double Returns power value of double type where
the function first parameter is base and
second parameter is index.
random() Nil double Returns random positive real value between
0 to 1 i.e. it may be 0.1 or 0.4 or 0.7 or 0.66
etc.
abs() double or float double Returns absolute value of variable.
ceil() double or float double Returns the double value greater than the
argument value.
Math.ceil( 9.01 ) will give 10.0
Math.ceil( -9.55) will give – 9.0
floor() double or float double Returns the double value less than the
argument value.
Math.floor( 9.99 ) will give 9.0
Math.floor(-9.55) will give -10.0
round() double or float int or long Rounds to the nearest integer. So, if the
value is more than half way towards the
higher integer, the value is rounded up to
the next integer. If the number is less than
this the next lowest integer is returned. So
far example if the input to round is x then:
2.0 <= x < 2.5 then Math.round(x) = 2
2.5 <= x < 3.0 then Math.round(x) = 3
rint() double or float double Returns the integer that is closed in value to
the argument. Returned as double.
Math.rint( 100.675) will give 101.0
Math.rint(100.500) will give 100.0
Math.rint( 100.200 ) will give 100.0
max() double, double double Returns maximum value of the two numeric
values.
min() double, double double Returns minimum value of the two numeric
values.

You might also like