Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #27457

Re: Can someone determine the output of this?

Newsgroups comp.lang.java.programmer
Date 2014-02-03 16:37 -0800
References <jYOdnUmn99dqv3LPnZ2dnUVZ_q6dnZ2d@giganews.com>
Message-ID <5850367c-0a73-495e-99af-7e371b093e9f@googlegroups.com> (permalink)
Subject Re: Can someone determine the output of this?
From Lew <lewbloch@gmail.com>

Show all headers | View raw


Please embed your question in the body of the post, not just the title. 

Question: "Can someone determine the output of this?"

securitygates wrote:
> public class Weather
> {
> 	public static void main(String [] arguments)
> 	{
> 		float fah=86;

Since this is a 'float' expression, you should express the constant as a float.

> 		System.out.println(fah + "degrees Farenheit is...");
> 		// To convert Farenheit into Celsius
> 		// Begin by subtracting 32
> 		fah = fah-32;
> 		// Divide the answer by 9
> 		fah = fah/9;
> 		// Multiply that answer by 5
> 		fah = fah*5;
> 		System.out.println(fah + "degrees Celsius\n");
> 
> 		float cel=33;
> 		System.out.println(cel + "degrees Celsius is...");
> 
> 		// To convert Farenheit into Celsius
> 		// Begin by subtracting 32

This is not subtraction of 32:
> 		cel = cel*9;

> 		// Divide the answer by 9

This is not division by 9:
> 		cel = cel/5;

> 		// Multiply that answer by 5

This is not multiplication by 5:
> 		cel=cel+32;
> 		System.out.println(cel + "degrees Farenheit");
> 	}
> }

Yes.

-- 
Lew

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Can someone determine the output of this? securitygates <bradyjimbsg@gmail.com> - 2014-02-02 23:02 -0600
  Re: Can someone determine the output of this? Lars Enderin <lars.enderin@telia.com> - 2014-02-03 12:20 +0100
    Re: Can someone determine the output of this? lipska the kat <lipskathekat@example.com> - 2014-02-03 13:15 +0000
  Re: Can someone determine the output of this? lipska the kat <lipskathekat@example.com> - 2014-02-03 13:36 +0000
  Re: Can someone determine the output of this? Roedy Green <see_website@mindprod.com.invalid> - 2014-02-03 09:18 -0800
  Re: Can someone determine the output of this? Lew <lewbloch@gmail.com> - 2014-02-03 16:37 -0800

csiph-web