Question

In: Computer Science

Write about the following topics: Objects Expressions             Numerical Types

Write about the following topics:

  • Objects
  • Expressions

            Numerical Types

Solutions

Expert Solution

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.

  • Object are used to represent and store the data in the system being described in VHDL.
  • Object contains a value of a specific type.
  • The name given to object is called identifier.
  • Each object has a type and class.

- 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.

  • An object is an instance of a class.
  • Object are created during program execution

-object is a run time concept.

  • Multiple objects can be instantiated of the same class.
  • Each object has its own values for the instance variable (attributes) of its class.

- 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.

  • Objects represents 'things' from the real world or from some problem domain.

e.g. the green car down there in the car park.

e.g. the teacher talking to you now.

e.g. you!

  • Classes represents all objects of a certain kind.

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.

  • Expressions are used to manipulate the data. Like in mathematics, expressions in programming languages, including C#, are constructed from the operands and operators.
  • Example: 2+2
  • An expression statement in C# ends with a semicolon (;).
  • The following code demonstrates an example for expressions:
  • simpleInterest = principal*time*rate/100;

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:

  1. Exponentiation
  2. Division and multiplication
  3. Addition and subtraction

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.


Related Solutions

Choose ONE of the following topics to write about: The Affordable Care Act 1. What is...
Choose ONE of the following topics to write about: The Affordable Care Act 1. What is the impact of this Affordablle Care Act on the US? 2. Which groups and/or people were most greatly affected? Which groups and/or people were least likely affected?
Pick the following topics, research it, and write a short essay/long paragraph (about a page and...
Pick the following topics, research it, and write a short essay/long paragraph (about a page and a half). Your research must be backed up by solid sources. peer reviewed sources . In all cases, you must use correct in-text citations and provide a bibliography. Must a be peer reviewed source Swimming with dolphins helps autistic kids
Lab 7. Boolean Expressions a) Write a program that evaluates the following expressions. Assign reasonable values...
Lab 7. Boolean Expressions a) Write a program that evaluates the following expressions. Assign reasonable values to the variables. Print the results. a<b≥c , √a−7 b2 ≠c , d∨e∧f , a<b∨¬d ∧means and, ∨means inclusive or, ¬ means not. b) Write a program that asks a user whether he or she wants to become a Java programmer and determines if the user typed “yes” (Print true if yes and false otherwise.) Don't use the if statement here
C++ Data Structure Write a program to change following infix expressions to postfix expressions using a...
C++ Data Structure Write a program to change following infix expressions to postfix expressions using a stack a) D-B+C b) C*D+A*B c) (A*B)*C+D*F-C d) (A-4*(B-C)-D/E)*F
write a paragraph about how can the following topics effect a chemistry research: 1- Theories of...
write a paragraph about how can the following topics effect a chemistry research: 1- Theories of arousal and performance 2- The stress process 3- How arousal, stress, and anxiety affect performance Psychology of sport
Write two paragraphs about how Schumpeter discovered Capitalism? and discuss following topics. Innovation as an Economic...
Write two paragraphs about how Schumpeter discovered Capitalism? and discuss following topics. Innovation as an Economic Entrepreneurship Failures and Investment Keynes and Economic Depression Boom and Bust Cycles Digital Revolution and Productive Speculation
Write a program that converts prefix expressions to postfix and postfix expressions to prefix. (java) The...
Write a program that converts prefix expressions to postfix and postfix expressions to prefix. (java) The program for this project should consist of three classes. -The main class should create a GUI that allows the user to input an expression in either prefix or postfix and convert it to postfix or prefix, respectively. -The other class should contain the code to perform the conversions. --->The pseudocode for prefix to postfix, which requires two stacks, is shown below: tokenize the string...
Write the equilibrium expressions for the dissolution of the following insoluble compounds and calculate the molar...
Write the equilibrium expressions for the dissolution of the following insoluble compounds and calculate the molar solubilities of each compound: a) AlAsO4, Ksp = 1.6x10-16 b) Cu2S, Ksp = 1.6x10-48 c) Pb3(AsO4)2, Ksp = 4.1x10-36
Write a program in Python to practice evaluating some logical expressions and determine whether the expressions...
Write a program in Python to practice evaluating some logical expressions and determine whether the expressions are equivalent. Read in a 0 or 1 integer value for each of the following variables: A, B, C, and D. Use an if…else statement to change the 0 and 1 integer values into True and False Boolean values. Booleans in Python have to have this capitalization (True/False, not true/false or TRUE/FALSE) and shouldn’t contain double quotes (which makes them a String instead of...
give a worked numerical example that covers all the topics in Non current asset held for...
give a worked numerical example that covers all the topics in Non current asset held for sale and discontinued operation, IFRS5. Please give numericals and not theory. thank you
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT