943,824 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 2445
  • Java RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Jul 21st, 2008
0

Re: help please

For 2, what are all even numbers divisible by that odd numbers are not?

For 4, loop backwards.

For 5, nested loops.

For 6, a loop and a an array of length 5 for summing, and divide by 10 and minus 5 to index into it.

There, there are the ideas for each of them.

Us doing your homework for you would not help you. You would learn nothing, and so would come back here tommorrow begging for "help" again, because what you need to do tommorrow built on what you did today, but you didn't do anything today (other than cut-n-paste). That's the way it is, if we simply do it for you, so, no, we are not going to do it for you, that does not help you. Those who fail with effort still understand more than those who pass without it.
Moderator
Reputation Points: 1471
Solved Threads: 490
Industrious Poster
masijade is offline Offline
4,043 posts
since Feb 2006
Jul 21st, 2008
0

Re: help please

thaaaaaaaanx my frind .... i'll do it and i will be back later ...


thaaaaaaaanx for ur advice ....


i'll be back
Reputation Points: 8
Solved Threads: 0
Newbie Poster
zoooz_20 is offline Offline
11 posts
since Jul 2008
Jul 21st, 2008
0

Re: help please

If you have solved a problem and you run it and it works then don't post it. Post only those that you are having problems with.
Sponsor
Featured Poster
Reputation Points: 1014
Solved Threads: 446
Nearly a Senior Poster
javaAddict is online now Online
3,259 posts
since Dec 2007
Jul 21st, 2008
0

Re: help please

hey again >>>


i have solve the second one>>
2. Write a program to compute the sum and product of all odd integers from 1 to 19.

<<<<<<<<<
the answer is :



Java Syntax (Toggle Plain Text)
  1. import java.util.Scanner;
  2.  
  3. public class program1 {
  4. public static void main(String [] args){
  5. Scanner scan =new Scanner(System.in);
  6.  
  7. int sum =0, product=1 ;
  8.  
  9.  
  10. for (int x = 1; x <= 19; x++) {
  11.  
  12. if (x % 2 ==1)
  13. sum=sum+x;
  14. }
  15.  
  16. for (int y = 1; y <= 19; y++) {
  17.  
  18. if (y % 2 ==1)
  19. product=product*y;
  20. }
  21.  
  22. System.out.println( sum+" "+ product );
  23.  
  24.  
  25. }
  26.  
  27. }



i dont know if its correct <<<

and the athers i dont understand the real idea >>

but i'll try ....
Last edited by Tekmaven; Jul 22nd, 2008 at 4:35 am. Reason: Code tags
Reputation Points: 8
Solved Threads: 0
Newbie Poster
zoooz_20 is offline Offline
11 posts
since Jul 2008
Jul 21st, 2008
-1

Re: help please

Does it compile?
Are there any errors?
Is it doing what you expect to do?

And please start using code tags (without spaces inside square brackets)
Quote ...
[ code=java]
private final String = "For easy readability, always wrap programming code within posts in [ code] (code blocks) and [icode] (inline code) tags.";
[/code]
Moderator
Featured Poster
Reputation Points: 2786
Solved Threads: 873
Code tags enforcer
peter_budo is offline Offline
6,656 posts
since Dec 2004
Jul 21st, 2008
0

Re: help please

It could help if you try to go over your program and write a pseudocode and then browse over java tutorials to interpret your pseudocode into java codes....

With a little effort you can answer these problems...

try the following links:
http://www.java2s.com/
http://www.roseindia.net/programming...Java-Tutorials
http://www.skillbuilders.com/Tutoria...0Tutorials.cfm
Last edited by loken; Jul 21st, 2008 at 10:24 pm. Reason: java references
Reputation Points: 10
Solved Threads: 0
Light Poster
loken is offline Offline
29 posts
since Jul 2008
Jul 22nd, 2008
1

Re: help please

With the exception of that second link which has mainly obsolete, and often times simply bad, tutorials/examples/advice. Roseindia is a blight on the Java world. Nearly everytime I see someone use some really bad practice on many forums and tell them not to do that, they often come back and say "But the tutorial I followed showed it this way!". And where did they get that tutorial ---> Roseindia. Nuff said.
Moderator
Reputation Points: 1471
Solved Threads: 490
Industrious Poster
masijade is offline Offline
4,043 posts
since Feb 2006
Jul 22nd, 2008
0

Re: help please

Click to Expand / Collapse  Quote originally posted by masijade ...
With the exception of that second link which has mainly obsolete, and often times simply bad, tutorials/examples/advice. Roseindia is a blight on the Java world. Nearly everytime I see someone use some really bad practice on many forums and tell them not to do that, they often come back and say "But the tutorial I followed showed it this way!". And where did they get that tutorial ---> Roseindia. Nuff said.
Lol...

The site didn't seem organized to me just at first glance. I'll probably never go there again.

I've probably learned more here than I have alone. Dani for the win (yes I spelled it out) =P
Reputation Points: 392
Solved Threads: 108
Posting Shark
Alex Edwards is offline Offline
971 posts
since Jun 2008
Jul 22nd, 2008
0

Re: help please

/facepalm

I now I feel like an uber noob for going to RoseIndia
Last edited by bloody_ninja; Jul 22nd, 2008 at 3:42 am.
Reputation Points: 9
Solved Threads: 1
Junior Poster in Training
bloody_ninja is offline Offline
96 posts
since Jul 2008
Jul 22nd, 2008
-1

Re: help please

Also first link to java2s.com is loose-win situation.
I would not recommend that site to beginner because either they will learn nothing from it as it does not contain any explanation to the code (code there is simple free copy to code from numerous books, some already out of date) or they will just copy&paste without understanding what that thing does.
However I use that site time-to-time, but I think I'm past the learning of for or while loops...
Moderator
Featured Poster
Reputation Points: 2786
Solved Threads: 873
Code tags enforcer
peter_budo is offline Offline
6,656 posts
since Dec 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: java homework help!!
Next Thread in Java Forum Timeline: Please Help Compiling Error





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC