Explain parentheses in java, JAVA Programming

Assignment Help:

Explain Parentheses in Java ?

Sometimes the default sequence of evaluation isn't what you want. For example, the formula to change a Fahrenheit temperature to a Celsius temperature is C = (5/9) (F - 32) whereas C is degrees Celsius and F is degrees Fahrenheit. You must subtract 32 from the Fahrenheit temperature before you multiply by 5/9, not after. You can use parentheses to adjust the frequently much as they are used in the above formula. The further program prints a table presentation the conversions from Fahrenheit and Celsius between zero and three hundred degrees Fahrenheit every twenty degrees.
// Print a Fahrenheit to Celsius table

class FahrToCelsius {

public static void main (String args[]) {

// lower limit of temperature table
double lower = 0.0;

// upper limit of temperature table
double upper = 300.0;

// step size
double step = 20.0;

double fahr = lower;
while (fahr <= upper) {
double celsius = (5.0 / 9.0) * (fahr-32.0);
System.out.println(fahr + " " + celsius);
fahr = fahr + step;
}

}


Related Discussions:- Explain parentheses in java

What is the use of forwardaction, Normal 0 false false fals...

Normal 0 false false false EN-IN X-NONE X-NONE MicrosoftInternetExplorer4

Developing a prototype system in php and javascript, General Overview A...

General Overview A number of organisations are using micro-blogging as a cost-effective way of communicating with customers, building online communities and releasing informati

Define object-to-relational (o/r) mapping, Object-to-Relational (O/R) mappi...

Object-to-Relational (O/R) mapping : There are various ways to persist data and the persistence layer is one of the most important layers in any application development. O/R ma

Explain the polymorphism principle, Explain the Polymorphism principle. ...

Explain the Polymorphism principle. Polymorphism can be referred as one name many forms. It's the ability of methods to behave differently, relying upon the object who is calli

What are adding methods, What are adding methods? A subclass isn't rest...

What are adding methods? A subclass isn't restricted to changing the behavior of its superclass. It can also add fully latest techniques and fields that are not shared along wi

Give a example of using tostring() methods, Give a example of Using toStrin...

Give a example of Using toString() Methods ? Below is a version of CarTest in which uses toString() and System.out.println() instead of printing the fields in a straight line

Pebbles merchant, There is a pebble merchant. He sells the pebbles, that ar...

There is a pebble merchant. He sells the pebbles, that are used for shining the floor. His main duty is to take the length of the room’s sides. But he sometimes mistakes doing that

What is the purpose to use the enableevents method, What is the purpose to ...

What is the purpose to use the enableEvents() method?

Boggle Game, any one out there with Boggle Source code?......i really need ...

any one out there with Boggle Source code?......i really need it guys please.

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd