Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Can't get rid of the error with this code pls help

Can't get rid of the error with this code pls help

Can't get rid of the error with this code pls help

Need help with basic java code

Hi guys. I need some help on this code. It compiles and I can get results when I run it on Netbeans but I always get RuntimeException.
I found out on javadocs this is the superclass of those exceptions that can be thrown during the normal operation of the Java Virtual Machine. How can I get rid of it? Any thoughts? Thanks!

CODE --> Java

// i++
        float Etplus, TrueEplus, TrueVplus, fplus1=0;
        //  Summation from i=1 to 10000
        for (int i=1;i<=10000;i++){
            fplus1 +=(float) 1/(Math.pow(i,4));
        TrueVplus = (float) ((Math.pow(Math.PI, 4)) / 90);
        TrueEplus = (float) TrueVplus - fplus1;
        Etplus = (float)(TrueEplus/TrueVplus)*100;
        JOptionPane.showMessageDialog (null,"Ft(i++) = "+TrueVplus + "\n\nFa(i++) = " +fplus1 + "\n\nEt(i++) = ("+Etplus+ ")%","Results for i++ (Float)", JOptionPane.INFORMATION_MESSAGE);
        // i--
        float Etminus, TrueEminus, TrueVminus, fminus1=0;

        //  Summation from i=10000 to 1
        for (int j=10000;j>=1;j--){
            fminus1 += (double) 1/(Math.pow(j, 4));

        TrueVminus = (double) (Math.pow((Math.PI), 4))/90;
        TrueEminus = (double) TrueVminus - fminus1;
        Etminus = (double) (TrueEminus/TrueVminus)*100;
        JOptionPane.showMessageDialog (null, "Ft(i--) = "
+TrueVminus + "\n\nFa(i--) = " +fminus1 + "\n\nEt(i--) = (" +Etminus+")%","Results for i--(Float)", JOptionPane.INFORMATION_MESSAGE);



Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close