Results 1 to 2 of 2
  1. #1
    metaleckz is offline Member
    Join Date
    Apr 2012
    Posts
    1
    Rep Power
    0

    Default For loop CtoF hw

    this is the assignment http://hills.ccsf.cc.ca.us/~cconner/...HW_6_111A.html
    password and username is visitor

    and here is my fail code -__-

    /* Craig Persiko/Constance Conner - CS 111A - Sample program
    InvestLoop.java

    A program to calculate the interest earned on an investment over time.
    */

    import java.util.Scanner;

    public class CtoF {

    public static void main(String [] args)
    {
    double balance;
    double Celsius = 0;

    Scanner scan = new Scanner(System.in);

    System.out.print( "Celsius");
    balance = scan.nextDouble();

    while(Celsius < 20) // repeat each Celsius for 20 degrees
    {
    balance = 9/5C +32; // calculate Celsius to Farenheit.
    Celsius++; // count the degree
    System.out.println("after " + Celsius + " years: "+ balance);
    }
    System.out.println("After 3 years at 5% interest you will have $"
    + balance);
    }
    }


    can you guys help me write a code or fix the code that I wrote that will turn out like this?
    Centigrade Fahrenheit
    ------------ --------------
    0 32
    1 34
    2 36
    3 .
    4 .
    5 .
    6 etc..
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    Last edited by metaleckz; 04-17-2012 at 04:54 AM. Reason: not specific enough

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default Re: For loop CtoF hw

    can you guys help me?
    Not without a specific question, no. How to ask questions the smart way

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Replies: 2
    Last Post: 11-07-2011, 03:25 AM
  2. Replies: 1
    Last Post: 10-01-2011, 03:12 AM
  3. JTextField loop 2x for-loop WEIRD!
    By Streetproject in forum AWT / Swing
    Replies: 2
    Last Post: 02-16-2011, 06:46 PM
  4. help w/ conversion of degrees(CtoF, FtoC)
    By clemsontigers in forum New To Java
    Replies: 11
    Last Post: 11-08-2010, 10:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •