Search:

Type: Posts; User: krillov

Search: Search took 0.17 seconds.

  1. Replies
    10
    Views
    668

    [SOLVED] Re: Double rounding

    Thanks, it worked. I tried in a smaller program like this:



    import java.text.DecimalFormat;

    public class Matte {

    public static final double PI = 3.14;
  2. Replies
    10
    Views
    668

    [SOLVED] Re: Double rounding

    I defined PI like this: public static final double PI = 3.14;

    Itīs very strange. I made a simple program and copied your code, but I got the same fail.



    import java.text.DecimalFormat;
    ...
  3. Replies
    10
    Views
    668

    [SOLVED] Re: Double rounding

    Thanks for you both. I changed like this but it isnīt working correctly I got this result 28.0. It should be 28.26. And if I change the value of "h" in the main then I get this message:
    ...
  4. Replies
    10
    Views
    668

    [SOLVED] Re: Double rounding

    Iīm not sure if I did right but I did like this:



    public static double volume (int r, int h)
    {
    DecimalFormat df = new DecimalFormat("#.##");
    double volym=PI*r*r*h;
    return...
  5. Replies
    10
    Views
    668

    [SOLVED] Double rounding

    Hi .. I would like to round off a number in a method and return the rounded number. I tried many different ways but I always got the same error message:

    Matematik.java:70: error: incompatible...
  6. Thread: Prim numbers

    by krillov
    Replies
    7
    Views
    459

    [SOLVED] Re: Prim numbers

    I fixed it. :)



    public class prim7 {

    public static void main (String[] args) {

    int prim=50;
    int j;
  7. Thread: Prim numbers

    by krillov
    Replies
    7
    Views
    459

    [SOLVED] Re: Prim numbers

    Thanks again! Process completed now and it writes out numbers or not. It depends on if I set "result" to true or false. So I realized that my method doesn't do anything at all just sending back the...
  8. Thread: Prim numbers

    by krillov
    Replies
    7
    Views
    459

    [SOLVED] Re: Prim numbers

    Thank you. I haven't seen it. I tried again but when i fix a fail there will be an other. It is now: "prim4.java:42: error: variable result might not have been initialized return result; " Do you...
  9. Thread: Prim numbers

    by krillov
    Replies
    7
    Views
    459

    [SOLVED] Re: Prim numbers

    Thank you! I was trying as you said but it still writes an error message like: ...\prim4.java:42: error: missing return statement. I canīt find out what the problem is.



    public class prim4 {
    ...
  10. Thread: Prim numbers

    by krillov
    Replies
    7
    Views
    459

    [SOLVED] Prim numbers

    I got a task to write a java program which can solve some mathematical actions. Every action has to be in separate methods. My problem is with a method which should sort prime numbers between 0 and a...
  11. Thread: Hey everyone!

    by krillov
    Replies
    1
    Views
    223

    Hey everyone!

    Hey!

    My name is Kristian. I'm beginner in programming, but I have already started to study on two courses at the university like Basic Java programming and Databases. My plan is to start studying...
Results 1 to 11 of 11