Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Many thanks to you for putting it together and to the forum members for taking the time to post their replies and give their time to help others. Their isn't another site that can touch it..."

Geography

Where in the world do Tek-Tips members come from?

Information on building a program

frankcpl (TechnicalUser)
27 Mar 12 9:29
I am having trouble understanding how to create a script on creating a schedule with conditions. I am not asking for anyone to provide code, unless they just want to, just help me understand the concept so I can learn to code it.

Thanks for any help
Bong (Programmer)
28 Mar 12 9:57
First of all, "script" implies maybe you're thinking of javascript rather than java.  If so, you're in the wrong forum.  If you're asking about a java program, then you need to think in classes.  What kind of objects will you have?  I suggest you think of the GUI itself (I assume you'll have some kind of GUI) as an object.  Then, your schedule can be an object or less elegantly it could be a property of the GUI.  Each object needs to be constructed, that is, there needs to be a method that creates the object and in so-doing, assigns its attributes. For the GUI, for instance, there are frames and buttons and choices and maybe even a canvas.  For the schedule class, if you go that way, there are items and (as you said in the OP) conditions.

You might want to look at some examples, for instance, here:
http://www2.cs.uic.edu/~sloan/CLASSES/java/

_________________
Bob Rashkin

frankcpl (TechnicalUser)
30 Mar 12 13:02
Thanks for the clarification. I am working with java, so classes is what I am after. Thanks again for the help. The next thing is, anyone explain how to randomly pick from a list without having duplicates. I am confused on how to "scratch" an array item from the selection list. Really do appreciate the help understanding.  
feherke (Programmer)
1 Apr 12 4:35
Hi

Quote (frankcpl):

anyone explain how to randomly pick from a list without having duplicates.
You mean, pick more than one random element from a list ? Again, your question is not really Java, it is more about the algorithm. There are multiple ways depending on the size of the list, the count of needed items, whether the original list is disposable. Some possible approaches :
  • Do until reached n items : pick a random item, check the list of already picked items if it contains it, if not, add it.
  • Do n times : pick a random item, then remove it from the list.
  • Shuffle the entire array then get the first n items.

Feherke.
http://feherke.github.com/

frankcpl (TechnicalUser)
9 Apr 12 12:11
Thanks again for the help. I think I understand it now. I am going to try and work out the coding for it. Again thanks a lot.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close