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

OOP, differentiate between states and behaviors of n object

differentiate between states and behaviors of n object

Explain final fields, Explain final fields ? You may also declare field...

Explain final fields ? You may also declare fields to be final. This is not the similar thing as declaring a method or class to be final. While a field is declared final, it is

What is an xml namespace?, Question 1 What is Response Redirection? Explai...

Question 1 What is Response Redirection? Explain in brief Question 2 What is JDBC? Explain Question 3 Write a short note on Expressions Question 4 What is an XML na

How would you interact between servlets and applets? , We may use the java...

We may use the java.net.URL and java.net.URLConnection classes to start a standard HTTP connection and "tunnel" to a Web server. The server then gives this information to the s

Illustrate the method to print on the GUI, Illustrate the method to print o...

Illustrate the method to print on the GUI Example Code: Taking Input / Output So far, we learned how to print something on console. Now time has come to learn how to print

How many modules are there in spring, Spring comprises of seven modules. Th...

Spring comprises of seven modules. They are.. a) The core container b) Spring context c) Spring AOP d) Spring DAO e) Spring ORM f)  Spring Web module g)  Sprin

Need java assignment for course, Need Java Assignment for course Project...

Need Java Assignment for course Project Description: I want to get an assignment done. Involves building on a minesweeper game written in Java. You subsequent code is to be u

Program for extend a java based database management system, Create a compre...

Create a compressed file that contains the eclipse project directory and a short document that describes:   the methods implemented any missing or incomplete elements o

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