Search:

Type: Posts; User: rph

Search: Search took 0.11 seconds.

  1. Replies
    7
    Views
    4,977

    Re: How to convert from type double to type int?

    Never mind I've figured it out myself, I just had to move

    int shortnumb2 = (int) shortnumb;

    int length2 = (int) length;

    into the public void paint class.
    Thanks for all your help :)
  2. Replies
    7
    Views
    4,977

    Re: How to convert from type double to type int?

    Yeah that's what the problem was, I hadn't declared length2 as a class variable, thanks :)
    However now I have the problem that the conversion from double to int makes the int value 0, any ideas why...
  3. Replies
    7
    Views
    4,977

    Re: How to convert from type double to type int?

    Ok I think I got that, but BlueJ is saying that I'm having an error still.

    import java.awt.*;
    import javax.swing.*;

    public class goldenrect extends JApplet
    {
    double length;
    public void...
  4. Replies
    7
    Views
    4,977

    How to convert from type double to type int?

    I need to convert the result of a calculation from type double to type int, what's the best way of going about this?
    I need to do this because I need the results of the calculation to be the length...
Results 1 to 4 of 4