Skip to main content

Featured Post

How to use Tabs in ASP.NET CORE

I want to show Components in a tabs , so first of all create few components. In this project we have three components, First View Component  public class AllViewComponent : ViewComponent     {         private readonly UserManager<ApplicationUser> _userManager;         public AllViewComponent(UserManager<ApplicationUser> userManager)         {             _userManager = userManager;         }         public async Task<IViewComponentResult> InvokeAsync()         {             List<StudentViewModel> allUsers = new List<StudentViewModel>();             var items = await _userManager.Users.ToListAsync();             foreach (var item in items)             {                 allUsers.Add(new StudentViewModel {Id=item.Id, EnrollmentNo = item.EnrollmentNo, FatherName = item.FatherName, Name = item.Name, Age = item.Age, Birthdate = item.Birthdate, Address = item.Address, Gender = item.Gender, Email = item.Email });             }            

Expressions and its types used in JAVA

An expressions is composed of one or more operations. The objects of the operation(s) are referred to as operands. The operations are represented by operators. Therefore, operators, constants, and variables are the constituents of expressions.

An Expression in Java is any valid combination of operators, constants, and variables are the constituents of Java tokens. The expression in Java can be of any type
  • Arithmetic expression
  • Compound expression
  • Relational (or logical) expression
Type of operators used in an expression determine the expression type. For instance, if an expression is formed using arithmetic operator, it is an arithmetic expression; if an expression has relational and/or Boolean operators, it is a Boolean expression. An arithmetic expression always results in a number (integer or real) and a logical expression always results in a logical value i.e., either true or false.

Arithmetic Expressions

Expressions and its types used in JAVA

Arithmetic expressions can either be pure integer expressions or pure real expressions. Sometimes a mixed expression can also be formed which is a mixture of real and integer expressions.
In pure expressions, all the operands are of same type. And in mixed expressions, the operands are of mixed or different data types.
Integer expressions are formed by connecting integer constants and/or integer variables using integer arithmetic operators.  The following are valid integer expression:

final int count = 30
int I, J, K, X, Y, Z
– J, K – X, K + X – Y + count, – J + K * Y, J/Z, Z % X

Real expression are formed by connecting real constants and/or real variables using real arithmetic operators. The following are valid real expression:

final float bal = 250.3f:
float qty, amount value;
double fin, inter;

Rule for these arithmetic expressions is the same and it states that:
An arithmetic expression may contain just one numeric variable or a constant, or it may have two or more variables or/and constants, or two or more expressions joined by valid arithmetic operators. Two or more variables or operators should not occur in continuation.

Apart from variables, constants and arithmetic operators, an arithmetic expression may consist of Java’s mathematical functions that are part of Java standard library and are available through Math class defined in java.lang package. The following image lists various math functions that are defined in the Math class of Java.lang package.

You can use these math functions as per following syntax:
Math.Function_name (argument list) ---- The arguments are the values required by a function to work upon. For example, to calculate ab, you may write: math.pow(a, b)

Following are examples of valid arithmetic expressions :
Given     int a, b, c ;  float, p, q, r ; double x, y, z ;
a/b, p/q +a-c, x/y + p*a/b, Math .sqrt (b)*a) – c, Math.ceil (p) + a)/c, Math. Max (c,b) +x/y – z/q +c  

Following are example of invalid arithmetic expressions :
Given int , a, b, c ;  float, p, q, r ;   double x, y, z ;
x + * r      two operators on continuation.
q(a + b – z/4)   operator missing between q and parenthesis.
Math.pow (0, - 1)  Domain error because if base = 0 then exp should not be <= 0.
n *log (-3) + p/q  Domain error because logarithm of negative number is not possible.

Comments

Popular Post

Polynomial representation using Linked List for Data Structure in 'C'

Polynomial representation using Linked List The linked list can be used to represent a polynomial of any degree. Simply the information field is changed according to the number of variables used in the polynomial. If a single variable is used in the polynomial the information field of the node contains two parts: one for coefficient of variable and the other for degree of variable. Let us consider an example to represent a polynomial using linked list as follows: Polynomial:      3x 3 -4x 2 +2x-9 Linked List: In the above linked list, the external pointer ‘ROOT’ point to the first node of the linked list. The first node of the linked list contains the information about the variable with the highest degree. The first node points to the next node with next lowest degree of the variable. Representation of a polynomial using the linked list is beneficial when the operations on the polynomial like addition and subtractions are performed. The resulting polynomial can also

How to use Tabs in ASP.NET CORE

I want to show Components in a tabs , so first of all create few components. In this project we have three components, First View Component  public class AllViewComponent : ViewComponent     {         private readonly UserManager<ApplicationUser> _userManager;         public AllViewComponent(UserManager<ApplicationUser> userManager)         {             _userManager = userManager;         }         public async Task<IViewComponentResult> InvokeAsync()         {             List<StudentViewModel> allUsers = new List<StudentViewModel>();             var items = await _userManager.Users.ToListAsync();             foreach (var item in items)             {                 allUsers.Add(new StudentViewModel {Id=item.Id, EnrollmentNo = item.EnrollmentNo, FatherName = item.FatherName, Name = item.Name, Age = item.Age, Birthdate = item.Birthdate, Address = item.Address, Gender = item.Gender, Email = item.Email });             }            

Memory representation of Linked List Data Structures in C Language

                                 Memory representation of Linked List              In memory the linked list is stored in scattered cells (locations).The memory for each node is allocated dynamically means as and when required. So the Linked List can increase as per the user wish and the size is not fixed, it can vary.                Suppose first node of linked list is allocated with an address 1008. Its graphical representation looks like the figure shown below:       Suppose next node is allocated at an address 506, so the list becomes,   Suppose next node is allocated with an address with an address 10,s the list become, The other way to represent the linked list is as shown below:  In the above representation the data stored in the linked list is “INDIA”, the information part of each node contains one character. The external pointer root points to first node’s address 1005. The link part of the node containing information I contains 1007, the address of