Jump to content

Need Help with Java Project


Recommended Posts

Posted

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

 

Posted
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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