Results 1 to 8 of 8
  1. #1
    kissmeeq is offline Member
    Join Date
    Aug 2011
    Posts
    8
    Rep Power
    0

    Default Idnk what to here >.< :( please help me in my threads

    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.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,520
    Blog Entries
    7
    Rep Power
    20

    Default

    What does this mean? "Idnk what to here >.< :("

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,401
    Rep Power
    25

    Default

    please help me in my threads
    The OP is looking for a good tailor. He's tired of jeans and sweatshirts.

  4. #4
    kissmeeq is offline Member
    Join Date
    Aug 2011
    Posts
    8
    Rep Power
    0

    Default

    aw sorry wrong grammar :( i dont know what to do here sorry :(

  5. #5
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,960
    Rep Power
    8

    Default

    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.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  6. #6
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,520
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by kissmeeq View Post
    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
    cenosillicaphobia: the fear for an empty beer glass

  7. #7
    kissmeeq is offline Member
    Join Date
    Aug 2011
    Posts
    8
    Rep Power
    0

    Default

    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



    Java 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);
        }
    }
    Last edited by JosAH; 08-01-2011 at 04:21 PM. Reason: added [code] ... [/code] tags

  8. #8
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,520
    Blog Entries
    7
    Rep Power
    20

    Default

    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
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Pls help me idnk what to do :((
    By kissmeeq in forum New To Java
    Replies: 6
    Last Post: 08-02-2011, 12:53 AM
  2. How to use two threads
    By rajan701v in forum Threads and Synchronization
    Replies: 2
    Last Post: 07-22-2011, 05:47 PM
  3. Threads and UML
    By JUser in forum Advanced Java
    Replies: 0
    Last Post: 09-27-2010, 08:43 PM
  4. Threads
    By Tanuck in forum New To Java
    Replies: 5
    Last Post: 09-21-2010, 02:44 AM
  5. Threads!
    By rameshraj in forum Advanced Java
    Replies: 1
    Last Post: 05-04-2008, 04:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •