Results 1 to 8 of 8
- 11-08-2011, 12:33 PM #1
Member
- Join Date
- Oct 2011
- Posts
- 5
- Rep Power
- 0
Short java programming, need help ASAP
So, the deal is I've got finals this week, and three tests in one day tomorrow, and I fell asleep at around 2 o clock in the morning, before I got around to trying my hand at writing these methods. I wouldn't ask for help unless I was desperate, so I ask that I can get some help with these two short programming tasks.
1. Write a method that will iteratively determine and return the Greatest Common Factor of two integers.
2. Write a method that will iteratively determine and return the factorial of an integer. (i.e. 5! = 5 * 4 * 3 * 2 * 1)
- 11-08-2011, 02:12 PM #2
Member
- Join Date
- Mar 2010
- Posts
- 31
- Rep Power
- 0
Re: Short java programming, need help ASAP
Sorry friend, we can only help with specific errors in your code. Please attempt to write it yourself and if you have problems with specific areas we'd be happy to help.
- 11-08-2011, 03:10 PM #3
Member
- Join Date
- Oct 2011
- Posts
- 5
- Rep Power
- 0
Re: Short java programming, need help ASAP
Ah, here's my attempt at it then:
public static int gcd(int a, int b)
{
if (b==0) return a;
esle
return gcd(b, a%b);
}
Will that work? Please help.
- 11-08-2011, 03:12 PM #4
Member
- Join Date
- Mar 2010
- Posts
- 31
- Rep Power
- 0
Re: Short java programming, need help ASAP
Have you tried running it? Does it return what you would expect?
- 11-08-2011, 03:17 PM #5
Member
- Join Date
- Oct 2011
- Posts
- 5
- Rep Power
- 0
Re: Short java programming, need help ASAP
No I haven't, when I go to External tools and try to run it, my programs never works and I can't.
- 11-08-2011, 03:18 PM #6
Member
- Join Date
- Mar 2010
- Posts
- 31
- Rep Power
- 0
Re: Short java programming, need help ASAP
What IDE are you using? Is that all the code you have written?
-
Re: Short java programming, need help ASAP
The order of things is to first study the material and then apply it. I suggest that you hit the basic Java tutorials first and study the information there, and afterwords only then try to create a program. You can't make this stuff up and the compiler is very picky.
- 11-08-2011, 05:13 PM #8
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,606
- Blog Entries
- 7
- Rep Power
- 17
Re: Short java programming, need help ASAP
When people rob a bank they get a penalty; when banks rob people they get a bonus.
Similar Threads
-
short message service (SMS in java)
By ashin in forum Advanced JavaReplies: 4Last Post: 06-04-2011, 07:59 AM -
Java Balancing Tree, please help right away ASAP !!!!
By Jumanji245 in forum New To JavaReplies: 2Last Post: 05-31-2011, 12:27 AM -
A java program to print short form of a name.
By Neeer in forum New To JavaReplies: 2Last Post: 03-20-2011, 06:16 AM -
short month = Short.parseShort(splitarray[2].toString()));
By AndyC in forum New To JavaReplies: 3Last Post: 02-20-2011, 12:15 PM -
Need Java Help ASAP
By L-dog in forum New To JavaReplies: 22Last Post: 10-02-2008, 11:54 PM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks