Results 1 to 7 of 7
  1. #1
    maggnus is offline Member
    Join Date
    Aug 2012
    Posts
    3
    Rep Power
    0

    Default Hello, im new to Java and need a little help

    Hey i just started programming and i bought the book "Introduction to programming in Java" and im having some trouble with the exercises and was wonduring if someone here could guide me throu one or two of them that im struggling with.

    I got all set up and all that but i cant get these two right, ill type up one of the exercises but if you guys are intrested in helping me please let me know and ill pm you the other one. Im asking you to guide me throu it dont just type the right answer since theres no challenge in that and i wont really learn anything from that :)

    but here it is and those of you that arent beginners like me probably can type it up in few seconds

    "Write a program that takes three positive integers as command-line-arguments and prints true if any one of them is greater or equal to the sum of the other two and false otherwise. (Note: This computation tests whether the three numbers could be the lengths of the sides of some triangle.)"

    thanks

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default Re: Hello, im new to Java and need a little help

    Give it your best shot and ask a specific question where you get stuck and you'll get all the help you need to learn.

    Learning resource: The Java™ Tutorials

    db

    edit
    Forum Rules -- especially the third paragraaph
    http://www.java-forums.org/forum-guides/9976-guide-new-members.html[/url]
    BB Code List - Java Programming Forum
    Last edited by DarrylBurke; 08-31-2012 at 06:37 PM.
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default Re: Hello, im new to Java and need a little help

    Quote Originally Posted by maggnus View Post
    Hey i just started programming and i bought the book "Introduction to programming in Java" and im having some trouble with the exercises and was wonduring if someone here could guide me throu one or two of them that im struggling with.

    I got all set up and all that but i cant get these two right, ill type up one of the exercises but if you guys are intrested in helping me please let me know and ill pm you the other one.
    No, please don't do that as that is not how this forum works. If you have questions or problems, please ask them here in the public forums. Our philosophy has always been to share problems and code with everyone, so please do not solicit help outside of the forum.

    Im asking you to guide me throu it dont just type the right answer since theres no challenge in that and i wont really learn anything from that :)
    Ask your specific questions and we'll try to help you out.

  4. #4
    maggnus is offline Member
    Join Date
    Aug 2012
    Posts
    3
    Rep Power
    0

    Default Re: Hello, im new to Java and need a little help

    Hi again and sorry about that i should have known better :/
    anyways ive been trying to get this to work but i have no idea if its doing what its supposed to do so can you check this code i wrote and see if im doing it right or atleast heading in the right direction

    Hello, im new to Java and need a little help-triangle.png

    thanks

  5. #5
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default Re: Hello, im new to Java and need a little help

    check this code i wrote and see if im doing it right
    Can you explain what the code is supposed to? Is the results when you execute the program correct?

    One problem with the code is that it changes the value of isTriangle three times but only prints out the value of the last time.
    The first two values are lost or ignored. If you want to know what its value was after any assignment statement, you need to print it out before changing it with another assignment statement.

    Please copy and paste code in the forum. It's not possible to select and copy code from an image for testing.
    Be sure to wrap posted code in code tags: BB Code List - Java Programming Forum


    There is a very useful statement in many programming languages: The comment. If they are added in the code to describe what the code is supposed to do and how it will attempt to do it, anyone reading the code will be able to see what it's supposed to do. The posted code has no comments making it harder for readers to know what it is supposed to do.
    Last edited by Norm; 08-31-2012 at 10:59 PM.
    If you don't understand my response, don't ignore it, ask a question.

  6. #6
    maggnus is offline Member
    Join Date
    Aug 2012
    Posts
    3
    Rep Power
    0

    Default Re: Hello, im new to Java and need a little help

    The program is supposed to print True if any integer is greater that or equal to the sum of the other two and false other wise

  7. #7
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default Re: Hello, im new to Java and need a little help

    What does the code do now when you execute it? Does it give the correct results?

    Did you add the other println statements after every assignment statement so the results of all the tests are shown and not lost?
    The code currently only prints the results of the last test.
    If you don't understand my response, don't ignore it, ask a question.

Posting Permissions

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