Re: Can someone determine the output of this?

Discussion in 'Java' started by Lew, Feb 4, 2014.

  1. Lew

    Lew Guest

    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
    Lew, Feb 4, 2014
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Aarti
    Replies:
    3
    Views:
    268
  2. Peña, Botp
    Replies:
    1
    Views:
    224
    Robert Klemme
    Jan 24, 2004
  3. Replies:
    0
    Views:
    89
  4. Lars Enderin
    Replies:
    0
    Views:
    102
    Lars Enderin
    Feb 3, 2014
  5. Roedy Green
    Replies:
    0
    Views:
    93
    Roedy Green
    Feb 3, 2014
Loading...

Share This Page