0% found this document useful (0 votes)
190 views3 pages

Java Mathematical Expressions Notes On 19-9-20 Class9 PDF

The document discusses how the round() method in Java handles negative numbers differently than positive numbers when rounding. Specifically, it notes that round() returns negative values as is, like positive numbers, but will round -0.5 down to the nearest lower integer (-1) unlike 0.5 which rounds up to 1. It provides examples rounding -1.5, -1.9, -1.2 (all rounding down) and 1.5, 1.9, 1.2 (all rounding up).

Uploaded by

ben martin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
190 views3 pages

Java Mathematical Expressions Notes On 19-9-20 Class9 PDF

The document discusses how the round() method in Java handles negative numbers differently than positive numbers when rounding. Specifically, it notes that round() returns negative values as is, like positive numbers, but will round -0.5 down to the nearest lower integer (-1) unlike 0.5 which rounds up to 1. It provides examples rounding -1.5, -1.9, -1.2 (all rounding down) and 1.5, 1.9, 1.2 (all rounding up).

Uploaded by

ben martin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

NOTE: round() method of Math class returns the negative values as it is

like positive numbers result but if the value is -0.5 then it rounds off to
nearest lower integer unlike 0.5
EX: (Negative numbers)
System.out.println( " round with negative="+Math.round(-1.5));//-1
System.out.println( " round with negative="+Math.round(-1.9));//-2
System.out.println( " round with negative="+Math.round(-1.2));//-1

(Positive numbers)

System.out.println( " round with positive="+Math.round(1.5));//2


System.out.println( " round with positive="+Math.round(1.9));//2
System.out.println( " round with positive="+Math.round(1.2));//1

 Java Mathematical Expressions:[2M] -- class 9 notes on 19/9/2020


 Convert the Mathematical Expression in to java format:

(n)
ICSE BASED QUESTIONS
REFER PAGES FROM 161 TO 164 FROM TB for assignments
H.W
Write down the following expressions in Java:

(a) (√3 * a2)


4

(b) a2 + b3 + c4

(c) (a + b)2
ab

(d) ∛(mn) + mn 3

Programs:
1.Write a program to calculate the value of the given expression:
1 + 2 + 3
a2 b2 c 2
2. The standard form of quadratic equation is represented as:
ax2 + bx + c = 0
where d= b2 - 4ac, known as 'Discriminant' of the equation.
Write a program to input the values of a, b and c.
Calculate the value of discriminant and display the output to the
nearest whole number.
If roots are imaginary d= -b ± √b2-4ac
2a

You might also like