need some help with this program, I am stumped appreciate any input,thank you

Discussion in 'Java' started by john, Dec 15, 2013.

  1. john

    john Guest

    An Armstrong number of three digits is an integer such that the sum of the cubes of its digits is equal to the number itself. For example, 371 is an Armstrong number, since 33 + 73 + 13 = 371. Write a method called isArmstrongNum to determine if a given number is an Armstrong number. Write a program that generates 100 three-digit random numbers and calls isArmstrongNum method to find all Armstrong numbers among these 100 random numbers.
     
    john, Dec 15, 2013
    #1
    1. Advertising

  2. john

    Joerg Meier Guest

    Re: need some help with this program, I am stumped appreciate any input, thank you

    On Sat, 14 Dec 2013 18:37:09 -0800 (PST), john wrote:

    > An Armstrong number of three digits is an integer such that the sum of the cubes of its digits is equal to the number itself. For example, 371 is an Armstrong number, since 33 + 73 + 13 = 371. Write a method called isArmstrongNum to determine if a given number is an Armstrong number. Write a program that generates 100 three-digit random numbers and calls isArmstrongNum method to find all Armstrong numbers among these 100 random numbers.


    We are not here to do your homework for you. If you actually have any
    problems with any of the instructions, feel free to ask specific questions.

    Liebe Gruesse,
    Joerg

    --
    Ich lese meine Emails nicht, replies to Email bleiben also leider
    ungelesen.
     
    Joerg Meier, Dec 15, 2013
    #2
    1. Advertising

  3. john

    Joerg Meier Guest

    Re: need some help with this program, I am stumped appreciate any input, thank you

    On Sat, 14 Dec 2013 18:37:09 -0800 (PST), john wrote:

    > An Armstrong number of three digits is an integer such that the sum of the cubes of its digits is equal to the number itself. For example, 371 is an Armstrong number, since 33 + 73 + 13 = 371. Write a method called isArmstrongNum to determine if a given number is an Armstrong number. Write a program that generates 100 three-digit random numbers and calls isArmstrongNum method to find all Armstrong numbers among these 100 random numbers.


    By the way, your question isn't even correct: 3*3*3 is not 33, 7*7*7 is not
    73, and 1*1*1 is not 13. Also, 33 + 73 + 13 is 119, not 371.

    Liebe Gruesse,
    Joerg

    --
    Ich lese meine Emails nicht, replies to Email bleiben also leider
    ungelesen.
     
    Joerg Meier, Dec 15, 2013
    #3
  4. john

    Eric Sosman Guest

    Re: need some help with this program, I am stumped appreciate anyinput, thank you

    On 12/14/2013 9:37 PM, john wrote:
    > An Armstrong number of three digits is an integer such that the sum of the cubes of its digits is equal to the number itself. For example, 371 is an Armstrong number, since 33 + 73 + 13 = 371. Write a method called isArmstrongNum to determine if a given number is an Armstrong number. Write a program that generates 100 three-digit random numbers and calls isArmstrongNum method to find all Armstrong numbers among these 100 random numbers.


    Here's the crux; filling in the rest should be simple:

    public static boolean isArmstrongNum(int oOO)throws
    java.net.MalformedURLException,java.io.IOException{
    java.io.BufferedReader ooo=new java.io.BufferedReader
    (new java.io.InputStreamReader(new java.net.URL("http:"
    +"//oeis.org/A005188/b005188.txt").openStream()));try{
    for(java.lang.String ooO;(ooO=ooo.readLine())!=null;){
    java.lang.String[]oOo=ooO.split("\\s+");if(oOo.length
    =='\u0002'&&oOo[oOo.length-1].equals(java.lang.Integer
    .toString(oOO))){return true;}}}finally{ooo.close();}
    return false;}

    --
    Eric Sosman
    d
     
    Eric Sosman, Dec 15, 2013
    #4
  5. john

    Jeff Higgins Guest

    Re: need some help with this program, I am stumped appreciate anyinput, thank you

    On 12/14/2013 09:37 PM, john wrote:
    > An Armstrong number of three digits is an integer such that the sum of the cubes of its digits is equal to the number itself. For example, 371 is an Armstrong number, since 33 + 73 + 13 = 371. Write a method called isArmstrongNum to determine if a given number is an Armstrong number. Write a program that generates 100 three-digit random numbers and calls isArmstrongNum method to find all Armstrong numbers among these 100 random numbers.
    >

    So, You Need to Write a Program but Don't Know How to Start
    <http://home.earthlink.net/~patricia_shanahan/beginner.html>
     
    Jeff Higgins, Dec 15, 2013
    #5
  6. john

    Jeff Higgins Guest

    Re: need some help with this program, I am stumped appreciate anyinput, thank you

    On 12/14/2013 09:45 PM, Joerg Meier wrote:
    > On Sat, 14 Dec 2013 18:37:09 -0800 (PST), john wrote:
    >
    >> An Armstrong number of three digits is an integer such that the sum of the cubes of its digits is equal to the number itself. For example, 371 is an Armstrong number, since 33 + 73 + 13 = 371. Write a method called isArmstrongNum to determine if a given number is an Armstrong number. Write a program that generates 100 three-digit random numbers and calls isArmstrongNum method to find all Armstrong numbers among these 100 random numbers.

    >
    > By the way, your question isn't even correct: 3*3*3 is not 33, 7*7*7 is not
    > 73, and 1*1*1 is not 13. Also, 33 + 73 + 13 is 119, not 371.
    >

    We still haven't found that missing caret.
     
    Jeff Higgins, Dec 15, 2013
    #6
  7. john

    Arne Vajhøj Guest

    Re: need some help with this program, I am stumped appreciate anyinput, thank you

    On 12/15/2013 10:07 AM, Eric Sosman wrote:
    > On 12/14/2013 9:37 PM, john wrote:
    >> An Armstrong number of three digits is an integer such that the sum of
    >> the cubes of its digits is equal to the number itself. For example,
    >> 371 is an Armstrong number, since 33 + 73 + 13 = 371. Write a method
    >> called isArmstrongNum to determine if a given number is an Armstrong
    >> number. Write a program that generates 100 three-digit random numbers
    >> and calls isArmstrongNum method to find all Armstrong numbers among
    >> these 100 random numbers.

    >
    > Here's the crux; filling in the rest should be simple:
    >
    > public static boolean isArmstrongNum(int oOO)throws
    > java.net.MalformedURLException,java.io.IOException{
    > java.io.BufferedReader ooo=new java.io.BufferedReader
    > (new java.io.InputStreamReader(new java.net.URL("http:"
    > +"//oeis.org/A005188/b005188.txt").openStream()));try{
    > for(java.lang.String ooO;(ooO=ooo.readLine())!=null;){
    > java.lang.String[]oOo=ooO.split("\\s+");if(oOo.length
    > =='\u0002'&&oOo[oOo.length-1].equals(java.lang.Integer
    > .toString(oOO))){return true;}}}finally{ooo.close();}
    > return false;}


    This raises a very interesting question.

    Are you most inspired by Stefans coding convention
    or by Roedy's how to write unmaintainable code?

    :)

    Arne
     
    Arne Vajhøj, Dec 15, 2013
    #7
  8. john

    Jeff Higgins Guest

    Re: need some help with this program, I am stumped appreciate anyinput, thank you

    An LUT. Wow, who'd a thunk it.
     
    Jeff Higgins, Dec 15, 2013
    #8
  9. john

    Joerg Meier Guest

    Re: need some help with this program, I am stumped appreciate any input, thank you

    On Sun, 15 Dec 2013 10:15:18 -0500, Jeff Higgins wrote:

    > On 12/14/2013 09:45 PM, Joerg Meier wrote:
    >> On Sat, 14 Dec 2013 18:37:09 -0800 (PST), john wrote:
    >>> An Armstrong number of three digits is an integer such that the sum of the cubes of its digits is equal to the number itself. For example, 371 is an Armstrong number, since 33 + 73 + 13 = 371. Write a method called isArmstrongNum to determine if a given number is an Armstrong number. Write a program that generates 100 three-digit random numbers and calls isArmstrongNum method to find all Armstrong numbers among these 100 random numbers.

    >> By the way, your question isn't even correct: 3*3*3 is not 33, 7*7*7 is not
    >> 73, and 1*1*1 is not 13. Also, 33 + 73 + 13 is 119, not 371.

    > We still haven't found that missing caret.


    Oh, that makes much more sense. I feel silly now.

    Liebe Gruesse,
    Joerg

    --
    Ich lese meine Emails nicht, replies to Email bleiben also leider
    ungelesen.
     
    Joerg Meier, Dec 15, 2013
    #9
  10. john

    Lew Guest

    Re: need some help with this program, I am stumped appreciate anyinput, thank you

    Joerg Meier wrote:
    > Jeff Higgins wrote:
    > > Joerg Meier wrote:
    > >> john wrote:
    > >>> An Armstrong number of three digits is an integer such that the sum of the cubes of its digits is equal to the number itself. For example, 371 is an Armstrong number, since 33 + 73 + 13 = 371. Write a method called isArmstrongNum to determine if a given number is an Armstrong number. Write a program that generates 100 three-digit random numbers and calls isArmstrongNum method to find all Armstrong numbers among these 100 random numbers.

    >
    > >> By the way, your question isn't even correct: 3*3*3 is not 33, 7*7*7 is not
    > >> 73, and 1*1*1 is not 13. Also, 33 + 73 + 13 is 119, not 371.

    >
    > > We still haven't found that missing caret.

    >
    > Oh, that makes much more sense. I feel silly now.


    Oh, you aren't the one who should be feeling silly. Why would anyone assumethe poster posted
    something other than what they intended to post?

    Silliness is on the part of the one who made the error, not the one who gave the respect to the
    poster to assume intentionality.

    --
    Lew
     
    Lew, Dec 17, 2013
    #10
  11. Re: need some help with this program, I am stumped appreciate anyinput, thank you

    Lew <> wrote:
    > Joerg Meier wrote:
    >> Jeff Higgins wrote:
    >>> Joerg Meier wrote:
    >>>> john wrote:
    >>>>> An Armstrong number of three digits is an integer such that the
    >>>>> sum of the cubes of its digits is equal to the number itself.
    >>>>> For example, 371 is an Armstrong number, since 33 + 73 + 13 = 371.
    >>>> By the way, your question isn't even correct: 3*3*3 is not 33, 7*7*7
    >>>> is not 73, and 1*1*1 is not 13. Also, 33 + 73 + 13 is 119, not 371.
    >>> We still haven't found that missing caret.

    >> Oh, that makes much more sense. I feel silly now.

    > Oh, you aren't the one who should be feeling silly. Why would anyone
    > assume the poster posted something other than what they intended to post?


    I think, that on his screen, john may have actually *seen* a raised 3
    after each of the 3,7,1. He just obviously wasn't aware, that text
    formatting wouldn't make it through to many/most of the audience...

    Alternatively, he might have typed the text with eyes on the keyboard,
    and his keyboard layout may have the caret as a "dead-key". So, while
    he might have typed a caret it just didn't show up, because he would
    have had to press space-key to make the dead-key effective on its own.

    PS: The silliness on my side includes (but isn't limited to) answering
    a thread that's probably long since off the track...
     
    Andreas Leitgeb, Dec 19, 2013
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Shapper
    Replies:
    1
    Views:
    1,893
    Alvin Bruney [MVP - ASP.NET]
    May 8, 2005
  2. Shapper
    Replies:
    3
    Views:
    416
    willow
    Jun 10, 2005
  3. Tom
    Replies:
    3
    Views:
    2,499
  4. Shawn
    Replies:
    8
    Views:
    388
    Shawn
    Sep 21, 2006
  5. shapper
    Replies:
    2
    Views:
    282
    Milosz Skalecki [MCAD]
    Jan 14, 2008
Loading...

Share This Page