INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • 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!

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

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Information on building a program

Information on building a program

(OP)
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

RE: Information on building a program

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

RE: Information on building a program

(OP)
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.  

RE: Information on building a program

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/

RE: Information on building a program

(OP)
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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

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!

Resources

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