Jump to content

Need Help with Java Project


Orange

Recommended Posts

Ok so I'm basically done with my project, and I am given several different numbers to input to test it. When I type in 1 for the x,y, and z values I get the correct answer, but if I type in 2, 3, etc I get the wrong answer (I checked with a calculator). So I assume somewhere I typed my equation wrong or perhaps its executing in the wrong order.

 

This is the equation that I must use:

http://prntscr.com/e18inb

 

This is my code for the project, and the equation is on lines 20 & 38 (at the bottom is where I run the program with the 2 for x,y,z the answer should be around 7.8 but I get -94):

http://prntscr.com/e18jtg

 

Thanks for the help

 

Link to comment
Share on other sites

4 minutes ago, Mumble said:

Maybe just order of operations on line 20

 

at the end of it you do / x * y * z

The computer sees this as (NUMBER/x)*y*z

 

so maybe try to add paranthesis

Thanks so much !!! I feel like a noob for not thinking about this, I've spent hours over this past week trying to figure out what I did wrong in the equation and it never occured to me to put () around the xyz part :facep: , thanks man I owe you one :doge: 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...