• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can any one explain me the output of this program  RSS feed

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


 
Marshal
Posts: 56600
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

By output, you mean in addition to the compiler error? Please be more specific in your thread titles and post post code which compiles and tell us the details, including what you expect and what actually happens. Since you are new, I have added code tags and you can see how much easier your post is to read.
Don't call your static abs method on the name of an object; call it on the name of the class. Like thisIn that abs method, c means the Complex number you are passing to that method; c.real is the real number associated with that Complex and simlarly for c.imag.
For the rest of it, you would have to look up some mathematics and see whether your calculation of the absolute value of that complex number is correct. It returns √(i² + r²)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!