Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 26 to 40 of 40

Thread: help with this code please!!!

Threaded View

  1. #1
    Junior Member
    Join Date
    Mar 2013
    Posts
    21
    My Mood
    Cool
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post help with this code please!!!

    Write a class that contains the following two methods:

    /** Converts from Celsius to Fahrenheit */

    Hello there guys please I need help with this program in java
    this what i have done so far , please any help would much appreciated
    Thanks.


    < public class EX5_8{
    public static void main(String args[]){
    /* public static double celsiusToFahrenheit(double celsius){
    return celsius=(5.0/9.0) * fahrenheit - 32;
    }
    public static double fahrenheitToCelsius(double fahrenheit){
    return fahrenheit=(9.0/5.0) * fahrenheit + 32;
    }*/
    System.out.println("|Celsius |Fahrenheit||Celsius |Fahrenheit| \n");
    int i=40;
    int j=120;
    do{
    System.out.printf("%3.1f|%11.1f|%3.1f|%8.2f|\n",i, (i*(9.0/5)+32),j,(j/i*(5.0/9)-32));
    i-=1;
    j-=10;
    }while(i<=31 && j<=30);
    }
    }
    >

    Find below is the complete question

    public static double celsiusToFahrenheit(double celsius)

    /** Converts from Fahrenheit to Celsius */
    public static double fahrenheitToCelsius(double fahrenheit)

    The formula for the conversion is:

    fahrenheit = (9.0 / 5) * celsius + 32

    Write a test program that invokes these methods to display the following tables:
    Celsius Fahrenheit Fahrenheit Celsius
    40.0 104.0 120.0 48.89
    39.0 102.2 110.0 43.33
    ...
    32.0 89.6 40.0 4.44
    31.0 87.8 30.0 -1.11

    Edit / Delete
    Last edited by fon90; March 31st, 2013 at 10:48 AM. Reason: systems administrators' requirement


Similar Threads

  1. Replies: 4
    Last Post: January 24th, 2013, 11:20 AM
  2. Replies: 7
    Last Post: January 24th, 2013, 10:41 AM
  3. Trouble Porting my Java File Reading Code to Android Code
    By Gravity Games in forum Android Development
    Replies: 0
    Last Post: December 6th, 2012, 04:38 PM
  4. Replies: 5
    Last Post: November 14th, 2012, 10:47 AM
  5. Replies: 3
    Last Post: September 3rd, 2012, 11:36 AM

Tags for this Thread