• 08-01-2011, 03:18 PM
kissmeeq
Problem 3: (Perfect.java)
Write a Java program that reads a positive, non-zero integer as input and checks if the integer is deficient, perfect, or abundant.
A positive, non-zero integer, N, is said to be perfect if the sum of its positive proper divisors (i.e., the positive integers, other than N itself, that divide N exactly) is equal to the number itself. If this sum is less than N, the number is said to be deficient. If the sum is greater than N, the number is said to be abundant.
For example, the number 6 is perfect, since 6 = 1 + 2 + 3, the number 8 is deficient, since 8 > 1 + 2 + 4, while the number 12 is abundant, since 12 < 1 + 2 + 3 + 4 + 6.

SAMPLE OUTPUT:
1.)Input N: 5
5 is deficient.

2.)Input N: 6
6 is perfect.

3.)Input N: 18
18 is abundant.
• 08-01-2011, 03:22 PM
JosAH
What does this mean? "Idnk what to here >.< :("

kind regards,

Jos
• 08-01-2011, 03:27 PM
Norm
Quote:

The OP is looking for a good tailor. He's tired of jeans and sweatshirts.
• 08-01-2011, 03:31 PM
kissmeeq
aw sorry wrong grammar :( i dont know what to do here sorry :(
• 08-01-2011, 03:34 PM
KevinWorkman
I recommend you check out the link in my signature on asking questions the smart way. For starters, don't write gibberish, and don't spam multiple posts. It would also help to show some effort and, you know, ask an actual question. What you're doing is little more than cheating, and people don't usually help cheaters.
• 08-01-2011, 03:36 PM
JosAH
Quote:

Originally Posted by kissmeeq
aw sorry wrong grammar :( i dont know what to do here sorry :(

Well, show us what you tried, maybe we can help you from there; you don't want us to do your homework do you?

kind regards,

Jos
• 08-01-2011, 04:00 PM
kissmeeq
sir here is my program but i dont know if im correct i cant figure out how to make the no. of terms summed up i dont know the formula please help me ill admit myself im weak at programming but i like to be a programmer

Code:

```/* this program calculates PI using the Gregory series...  */ import java.util.*; public class GregorySeries {     public static void main(String[] args) {         // get user input...         double a;         Scanner kbd = new Scanner(System.in);         System.out.print("Input Limit: ");                 a = kbd.nextDouble();                 double n = 41;                 while (n<0.005) {                         n++;                         System.out.println(n+ "No. of terms summed up:" );                 }         // ensure that the input value is valid...         if (n < 1) {             System.out.println("Please input a positive integer value.");             System.exit(0);         }         // initialize variables...         double pi = 0;      // 'running' sum...         double divisor = 1;  // divisor for the current term         boolean add = true;  // flag whether to add or subtract                             //  term from the running sum...         int term = 1;        // number of terms summed so far...         while (term <= n) {             // add or subtract the current term to or from the             //  running sum, as appropriate...             if (add) {                 pi += 4 / divisor;             } else {                 pi -= 4 / divisor;             }             // update variables...             divisor += 2;             add = !add;             term++;         }         // output calculated value of PI...         System.out.println("\nCalculated Value of PI: " + pi);     } }```
• 08-01-2011, 04:27 PM
JosAH
What does this approximation of pi has to do with perfect numbers? Please keep all your threads separated; you're making a mess out of things.

kind regards,

Jos
• 10-12-2014, 08:51 AM
Lloydaaa
Sup bro, Are you done with your Problem 3 ? can you send me ? :( Thats my problem to </3
Thanks bro. GodBless youu
• 10-12-2014, 09:10 AM
JosAH
Quote:

Originally Posted by Lloydaaa
Sup bro, Are you done with your Problem 3 ? can you send me ? :( Thats my problem to </3
Thanks bro. GodBless youu

Suppose the OP sends you a bit of code; are you going to turn it in as if it were yours? Maybe you pass your classes and graduate, while you still don't know anything; I feel sorry for your future co-workers, because they continuously have to clean up and fix your mess (before you get fired). Please show some effort and don't beg here; other moderators may not be so nice as I am and ban you from this forum immediately.

Jos
• 10-12-2014, 07:42 PM
jim829