simple JAVA expression help!?

The length of a rectangle is stored in a double variable named length , the width in one named width . Write an expression whose value is the length of the diagonal of the rectangle.


this is what i put:
double diagonal=sqrt((length*length)+(width*width));

but its wrong

R.A.K.2012-09-13T08:09:20Z

Favorite Answer

It should be: double diagonal= Math.sqrt((length*length)+(width*width));

?2016-12-12T12:17:58Z

A recursive descent parser supplies the shortest and maximum elementary code. you basically would desire to define expressions expression :=: expression operand expression Your application keeps recognizing expressions till it properly-knownshows a term (like "12") and then evaluates up the tree. Algortithms for recursive descent parsers are rather previous (because of the fact the 70's) and are available a great style of languages. between the 1st obtainable e-e book is in Pascal via Niklaus Wirth, the inventor of Pascal. The identify of that e book: courses = Algortithms + records structures. some issues in no way exchange.

kenzo20472012-09-13T08:06:23Z

Why is that wrong ? The formula looks right to me.