# New guy with a problem

Thomas Hacker

Greenhorn

Posts: 4

posted 9 years ago

Hello everyone! How you guys doin? First off, let me introduce myself. I am TJ Hacker and I am a freshman at RIT. I currently have a Introduction to Programming class.

As for the problem, I have to make two classes, one real and the test. I got the test class all worked out and perfect. the Real class is NEARLY there.

The program states that i have to create two methods using fractionals and summations.

i got the positive fractionals and summations up and working, but i'm stuck with the negative inputs.

Sorry, i'm asking for an input to ask which method to use and then a number. if it's positive, works perfect. If it's negative, however, i'm clueless lol.. any takers?

Any help would be appreciated! smile.gif biggrin.gif

Here's the Java code....It's in two classes but you don't really need the Real class so.

The negative parts are wrong i know, i was just messing around to see what i could come up with.

As for the problem, I have to make two classes, one real and the test. I got the test class all worked out and perfect. the Real class is NEARLY there.

The program states that i have to create two methods using fractionals and summations.

i got the positive fractionals and summations up and working, but i'm stuck with the negative inputs.

Sorry, i'm asking for an input to ask which method to use and then a number. if it's positive, works perfect. If it's negative, however, i'm clueless lol.. any takers?

Any help would be appreciated! smile.gif biggrin.gif

Here's the Java code....It's in two classes but you don't really need the Real class so.

The negative parts are wrong i know, i was just messing around to see what i could come up with.

Thomas Hacker

Greenhorn

Posts: 4

posted 9 years ago

ah. It states in the paper that Factorial (-n) are defined as = -1 * factorial(n).

As a friendly reminder, factorials work in n! as in 6! = 720. So for example, -6! would be -720.

For the Summations, it states that if a negative number is inputted, make sure it is changed to a positive number. HINT: use the multiplication of -1.

I just dont understand this fully.

As a friendly reminder, factorials work in n! as in 6! = 720. So for example, -6! would be -720.

For the Summations, it states that if a negative number is inputted, make sure it is changed to a positive number. HINT: use the multiplication of -1.

I just dont understand this fully.

posted 9 years ago

I could give you the answer, but trust me, you will hate me for it...

The key to the problem is following this quote...

And writing it as a recursive expression. If "num" is negative, how would you write the expression for result that follows the quote.

Henry

The key to the problem is following this quote...

It states in the paper that Factorial (-n) are defined as = -1 * factorial(n).

And writing it as a recursive expression. If "num" is negative, how would you write the expression for result that follows the quote.

Henry

Thomas Hacker

Greenhorn

Posts: 4

Thomas Hacker

Greenhorn

Posts: 4