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


Groups > comp.lang.java.programmer > #27442 > unrolled thread

Can someone determine the output of this?

Started bysecuritygates <bradyjimbsg@gmail.com>
First post2014-02-02 23:02 -0600
Last post2014-02-03 16:37 -0800
Articles 6 — 5 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  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

#27442 — Can someone determine the output of this?

Fromsecuritygates <bradyjimbsg@gmail.com>
Date2014-02-02 23:02 -0600
SubjectCan someone determine the output of this?
Message-ID<jYOdnUmn99dqv3LPnZ2dnUVZ_q6dnZ2d@giganews.com>
public class Weather
{
	public static void main(String [] arguments)
	{
		float fah=86;
		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
		cel = cel*9;
		// Divide the answer by 9
		cel = cel/5;
		// Multiply that answer by 5
		cel=cel+32;
		System.out.println(cel + "degrees Farenheit");
	}
}
---
securitygates

[toc] | [next] | [standalone]


#27446

FromLars Enderin <lars.enderin@telia.com>
Date2014-02-03 12:20 +0100
Message-ID<52EF7B8A.3050002@telia.com>
In reply to#27442
2014-02-03 06:02, securitygates skrev:
> public class Weather
> {
> 	public static void main(String [] arguments)
> 	{
> 		float fah=86;
> 		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
> 		cel = cel*9;
> 		// Divide the answer by 9
> 		cel = cel/5;
> 		// Multiply that answer by 5
> 		cel=cel+32;
> 		System.out.println(cel + "degrees Farenheit");
> 	}
> }

I can see that you are extremely sloppy, re-using the comments from the
first part without a thought. Your signature sucks, too.

-- 
Lars Enderin

[toc] | [prev] | [next] | [standalone]


#27447

Fromlipska the kat <lipskathekat@example.com>
Date2014-02-03 13:15 +0000
Message-ID<VvKdnbmRjZrgC3LPnZ2dnUVZ7qqdnZ2d@bt.com>
In reply to#27446
On 03/02/14 11:20, Lars Enderin wrote:
> 2014-02-03 06:02, securitygates skrev:

[snip]

> I can see that you are extremely sloppy, re-using the comments from the
> first part without a thought. Your signature sucks, too.

A quality response as usual Lars.
Why do you even bother?

-- 
Lipska the Kat©: Troll hunter, sandbox destroyer,
treacherous feline and farscape dreamer of Aeryn Sun
GNU/Linux user #560883 - http://www.linuxcounter.net

[toc] | [prev] | [next] | [standalone]


#27449

Fromlipska the kat <lipskathekat@example.com>
Date2014-02-03 13:36 +0000
Message-ID<OMadnX0X-v7ZBnLPnZ2dnUVZ7sydnZ2d@bt.com>
In reply to#27442
On 03/02/14 05:02, securitygates wrote:
> public class Weather
> {

$ cd temp
$ touch Weather.java
$ nano Weather.java
copy and past the code then save it.
$ javac Weather.java
$ java Weather


-- 
Lipska the Kat©: Troll hunter, sandbox destroyer,
treacherous feline and farscape dreamer of Aeryn Sun
GNU/Linux user #560883 - http://www.linuxcounter.net

[toc] | [prev] | [next] | [standalone]


#27453

FromRoedy Green <see_website@mindprod.com.invalid>
Date2014-02-03 09:18 -0800
Message-ID<lpjve91mckvlvqr8bvvt826vf0fahk50oj@4ax.com>
In reply to#27442
On Sun, 02 Feb 2014 23:02:47 -0600, securitygates
<bradyjimbsg@gmail.com> wrote, quoted or indirectly quoted someone who
said :

>public class Weather

see http://mindprod.com/jgloss/javacexe.html for how to compile
see http://mindprod.com/jgloss/javaexe.html for how to run

The output will be what you desire.

see http://mindprod.com/jgloss/jdk.html
if you don't have a jdk installed yet.
-- 
Roedy Green Canadian Mind Products http://mindprod.com
Because a thing seems difficult for you, do not think it 
impossible for anyone to accomplish.
~ Marcus Aurelius 121-04-26 180-03-17 

[toc] | [prev] | [next] | [standalone]


#27457

FromLew <lewbloch@gmail.com>
Date2014-02-03 16:37 -0800
Message-ID<5850367c-0a73-495e-99af-7e371b093e9f@googlegroups.com>
In reply to#27442
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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web