Results 1 to 7 of 7
- 08-31-2012, 03:36 PM #1
Member
- Join Date
- Aug 2012
- Posts
- 3
- Rep Power
- 0
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
- 08-31-2012, 04:12 PM #2
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 ForumLast edited by DarrylBurke; 08-31-2012 at 05:37 PM.
Why do they call it rush hour when nothing moves? - Robin Williams
-
Re: Hello, im new to Java and need a little help
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.
Ask your specific questions and we'll try to help you out.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 :)
- 08-31-2012, 08:38 PM #4
Member
- Join Date
- Aug 2012
- Posts
- 3
- Rep Power
- 0
Re: Hello, im new to Java and need a little help
- 08-31-2012, 09:55 PM #5
Re: Hello, im new to Java and need a little help
Can you explain what the code is supposed to? Is the results when you execute the program correct?check this code i wrote and see if im doing it right
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 09:59 PM.
If you don't understand my response, don't ignore it, ask a question.
- 08-31-2012, 10:41 PM #6
Member
- Join Date
- Aug 2012
- Posts
- 3
- Rep Power
- 0
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
- 08-31-2012, 10:52 PM #7
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.


LinkBack URL
About LinkBacks
Reply With Quote


Bookmarks