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

Create an online multiple choice quiz, Create an online multiple-choice qui...

Create an online multiple-choice quiz using JSP/Servlets technology. The quiz should draw questions from an array of predefined questions (at least fifteen). You should use a meani

Illustrate inheritance and composition?, The ' is a ' relationship is use...

The ' is a ' relationship is used with inheritance and ' has a ' relationship is used with composition . Both composition and inheritance allow you to perform sub-objects in

Why use rmi when we can handle the same benefits from ejb?, EJBs are distri...

EJBs are distributed elements, which need the RMI framework for object distribution. An EJB application server gives more services like object pooling, transaction management, data

Difference hashcode and equal, The hashCode() and equals() methods have...

The hashCode() and equals() methods have to be very important, when objects implementing these two functions are added to collections. If not implemented or implemented incorre

Component developer to code in java, Component Developer to code in Java: ...

Component Developer to code in Java: Worked for Sansri's Gateway as Software Engineer . Here I Worked as a Component Developer to code in Java and J2EE technologies Here Ensu

We need a java developer, We need a Java Developer a) Having 4.6 years o...

We need a Java Developer a) Having 4.6 years of I.T experience Java, J2EE, spring, Hibernate, JSF, Swings. b) Analyze, identifying and understanding the client requirements a

Android apk for 3g dongles support, ANDROID APK for 3G dongles support P...

ANDROID APK for 3G dongles support Project Description: We want someone who will modify this Android app or code a similar one. The App function is to let Android tablet P

Difference between a stringbuffer and a string class?, String is immutabl...

String is immutable in java : you can't change a string object but can replace it by creating a new object instance. Creating a new instance is rather expensive.   //Non ef

I need java coding, I need Java coding Need to develop a website. Requir...

I need Java coding Need to develop a website. Require Java coder's urgently. Skills required: HTML, Graphic Design, Java, PHP, Website Design

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