In: Computer Science
Write about the following topics:
Numerical Types
1. Object
An object is an abstract data tye with the addition of inheritance and polymorphism. Rather than structure programs as code and data, an object- oriented syatem integrates the two using the concept of an objecy. An object has state (data) and behavior (code). Object can corresponds to things found in the real world.
- Class indicates how the object is used in the model and what can be done with the object.
- Type indicates what tyoe of data the object contains.
-object is a run time concept.
- these values define the state of the object.
A class is a group of objects that have similar characteristics and that exhibit similar behavior.
An object is a specific instance of a class.
e.g. the green car down there in the car park.
e.g. the teacher talking to you now.
e.g. you!
e.g. Car, Teacher, Student.
Example
The set of all students forms the class Student.
Each individual student is an object of the class Student.
Ram and Rohith are instance of Student.
2. Expressions
In computer science, an expression is a synthetic entity in a programing language that may be evaluated to determine its value. It is a combination of one or more constants, variables, functions, and operators that the programming language interprets and computer to produce another value.
An expression is a combination bof values (i.e. constant), variables and operators. It generates a single value, which by itself is an expression.
Example
2+2
Here 2 is the value or operands and + is an operator.
The expression is solved by Computer and gets its value. In the above example, it will be 4, and we say the expression is evaluated.
Note: Expression value innturn can act as Operands and Operators.
We have seen many such expressions (with list of operators as example). 10+5 and 9+4+2 are two expressions which will result into value 16. Taking another example, 50/4+(6-3.0) is an expression in which values of different data types ate used. These type of expressions are also known as mixed type expressions.
Types of expressions
Constant Expressions
Integral Expressions
Floting Expressions
Bitwise Expressions
Pointer Expressions
Logicsl Expressions
Relational Expressions
Numerical Type
A numeric expression performs a caluclation that uses numeric constant, variables, operators, or functions to return a numeric value. A numeric expression can consist of the following components,
A numeric constant. For example
COMPUTE_COUNT/I2 =1;
A numeric variable. For example;
COMPUTE_RECOUNT/I2 = Count;
Two numeric constants or variables njoimed by a numeric operator. For example:
COMPUTE BONUS/D12.2 = CURR_SAL *0.05;
A numeric function. For example
COMPUTE LONGEST_SIDE/D12.2 = MAX(WIDTH,HEIGHT);
Order of Evaluation
Maintain data performs numeric operation in the following order:
When the operators are at the same level, they are evaluated left to right. Because expression in parantheses are evaluated before any other expression.
Evaluating numeric expression
Maintain Data follows a specific evaluation path for each numeric expression based on the format of the operators. If the operands all have the same format, most operation are carried out in that format. This is known as native-mode arithmetic.
In any language programming language, there are many different types of data. In praying, the types of data used to store a numerical value. There are four different types of prayer to pray.
1. INT (normal subscribers): This is a pretty level- clear white integers thatball the numbers are positive or negative.
2. Long (longest canteen): the longest ones are the size of the size limit. All seem to be normal of they ate followed by the letter "L' (example150L).
3 float (float point value): follow a true representative , but a decimal point( or notation scientific) ro divide the total number of fractions.
4 Hard (solid numbers): It is defined by milk +bj, where a and b are clean and j is the square-1 ( the result of which is an imaginative number). Complex numbers are used for the sake of praying.
Applying the driver function call() to create a type of sample in a number of tyoes. For example: call INT (x) Returned to appearance x. It can also be used for a long, long time, and hard.
Example
Use a numeric expression to perform caluclation that uses numeric constant (integer or decimal) and variables. For example, you can write an expression to compute the bonus for each employee by multiplying the current salary by the desired percentage as follows
COMPUTE Bonus = Curr_Sal * 0.05;
A numeric expression returns a numeric value.