0

My program on compound interest gets compiled fine but it won't display anything .

Yesterday When I created a new class and tried to run a simple for loop , the same thing happened . But when I tried to run the same for loop in a previously made class , it ran just fine .

Source code :

class mangoes{
    public static void main(String[] args){

        double amount;
        double principal = 1000;
        double rate = .01;
        for(int day=1;day<=20;day++){
            amount=principal*Math.pow(1 + rate , day);

            System.out.println(day + "  "+ amount);
        }

    }

}

So is there some kind of problem with my eclipse ?

3
Contributors
3
Replies
4
Views
4 Years
Discussion Span
Last Post by im abcd
0

By using Eclipse you are adding layers of complexity to your task. I can't immediately see anything wrong with you code, so its probably something to do with your usage of Eclipse, eg the run configuration.
At your stage of learning you would be best advised to stick to a programmer's editor and the command line compiler. Eclipse is really a tool for expert users.

0

I ran that code here, runs just fine. it can be tons of reasons: maybe you didn't save the file, maybe you didn't re-compile, maybe you're running the wrong file, ..

0

I found the solution to this problem , it was my foolishness that caused it .

While creating the class I used to specify a different name and then while coding I used to write a different name for the class :P.
So this caused the problem .

Anyways thanks for all the help .

Edited by im abcd

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.