Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
J2SE > Temperature calculator
09-21-2010, 09:54 PM (This post was last modified: 10-02-2010 03:04 PM by masokis.)
Post: #1
J2SE > Temperature calculator
Holla.. here is my code...
i create it. It use 2 method inside it. Good source code to learn meth0d in java..
Code:
class LAB5E4
{
    public static void main(String args[])
    {
        int Centigrade = Integer.parseInt(args[0]);

        System.out.println("=> "+Centigrade+"'C is "+F(Centigrade)+"'F");
        System.out.println("=> "+F(Centigrade)+"'F is "+C(F(Centigrade))+"'C");
    }
    static int F(int c) // <-- method for Centrigrade to Fahrenheit
    {
        int kira;
        kira=((9*c/5)+32);
        return kira;
    }

    static int C(int f) // <-- method for Fahrenheit  to Centigrade
    {
        int kira;
        kira=(f-32)*5/9;
        return kira;
    }

}

http://www.masokis.com/blog/kod-java-pro...fahrenheit
User Tools
Quote this message in a reply
11-22-2011, 07:07 AM
Post: #2
RE: J2SE > Temperature calculator
Good stuuf !
User Tools
Quote this message in a reply
Post Reply 




User(s) browsing this thread:
1 Guest(s)