| We hope you enjoy your visit. You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free. Join our community! If you're already a member please log in to your account to access all of our features: |
| Java Programmers please review this | |
|---|---|
| Tweet Topic Started: Jan 8 2005, 02:18 PM (521 Views) | |
| Deleted User | Jan 8 2005, 02:18 PM Post #1 |
|
Deleted User
|
we have this program called javagods in my class that randomly pairs everyone but cant have a duplicate person. and when i saw its source i was appalled at it and said i could write a better code. turns out rewriting it is rather difficult. here is the source i have come up with and please review it and make suggestions/comments if u have any advice on how to make it better.
the last line to print the names was just to check if everyone was used and no duplicates were found. this is just the main part of the code that is needed to run the pairing, the actual last part i can whip up later |
|
|
| kingy | Jan 8 2005, 02:37 PM Post #2 |
|
1 in 10 people understands binary, the other 1 doesn't
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
picking straws is so much simpler... as for the java it looks alright...i havent seen anything i could simplify. but then again i only just learnt java |
![]() |
|
| Deleted User | Jan 8 2005, 02:55 PM Post #3 |
|
Deleted User
|
thx, |
|
|
| Seth | Jan 8 2005, 03:32 PM Post #4 |
|
I has a pony
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
:'( Java makes me cry, so many lines to do such a simple task. But it looks like you've done it well. The one thing I would say is that it is very hardcoded. You have the number 22 everywhere. Why not assign the array of names, then define a variable counting the number of array entries. That way, if a new person joins the class, no code editing required. |
![]() |
|
| kingy | Jan 8 2005, 04:14 PM Post #5 |
|
1 in 10 people understands binary, the other 1 doesn't
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
yeah but other than that its fine |
![]() |
|
| dirty-devil | Jan 8 2005, 04:50 PM Post #6 |
|
the power of christ compelles you !!!
![]() ![]() ![]() ![]() ![]() ![]()
|
can we use this in our forums ? |
![]() |
|
| kingy | Jan 8 2005, 04:52 PM Post #7 |
|
1 in 10 people understands binary, the other 1 doesn't
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
lol...no its not even a complete code, and its java, not javascript i suppose a javascript equivilant would be possible |
![]() |
|
| dirty-devil | Jan 8 2005, 05:11 PM Post #8 |
|
the power of christ compelles you !!!
![]() ![]() ![]() ![]() ![]() ![]()
|
whats the difference java javascript |
![]() |
|
| kingy | Jan 8 2005, 05:22 PM Post #9 |
|
1 in 10 people understands binary, the other 1 doesn't
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
|
![]() |
|
| Hero_of_time | Jan 10 2005, 10:56 AM Post #10 |
|
I love Emily :wub:
![]() ![]() ![]() ![]() ![]() ![]()
|
What is JavaScript? JavaScript is a programming language that originated with Netscape. It's very easy to use and makes your Web site more interactive to visitors. What is Java? Introduced by Sun Microsystems in 1995, Java is a programming language that was designed for the internet environment. It can be used to write programs which can be embedded in your Web site. What is the difference between JavaScript and Java? Java creates stand alone applications, like applets, JavaScript does not. JavaScript was developed to interact with the HTML of a Web site. |
![]() |
|
| korn_mosher_4life-ZNS | Jan 11 2005, 09:04 PM Post #11 |
|
the korn mosher 4life
![]() ![]() ![]() ![]() ![]() ![]()
|
so true, it hurts my eyes trying to read all these damn lines of it. Just to do something I could do in javascript. Anywho the hardcoded part is true, do what seth said it would help. Other then that looks good. and as for me, java is easier then javascript. |
![]() |
|
| Rory | Jan 11 2005, 09:43 PM Post #12 |
|
i;m a mess
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
i hate java, but have to learn it. It is similar to php, but at the same time, not.... if that makes any sense. |
![]() |
|
| Deleted User | Jan 12 2005, 06:51 PM Post #13 |
|
Deleted User
|
well....its "almost" correct. i could do it by setting 22 variables...but i dont want to. i just wanted to make a friggen array...but no their is no
and the second part i could do it like this:
i mean what the hell!? i swear im e-mailing Sun Microsystems tonight to have them update their API and update this to the JRE and SDK note: the use would be range(object, int index, int end) |
|
|
| kingy | Jan 13 2005, 04:26 AM Post #14 |
|
1 in 10 people understands binary, the other 1 doesn't
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
i think seth meant make 22 a variable, since it comes up so much |
![]() |
|
| 1 user reading this topic (1 Guest and 0 Anonymous) | |
| « Previous Topic · Technology Chat · Next Topic » |
| Track Topic · E-mail Topic |
8:51 PM Jul 10
|





![]](http://b1.ifrm.com/0/1/0/p601690/pipright.png)

8:51 PM Jul 10