• Welcome to Valhalla Legends Archive.
 

need EXTREME help on a schedule program

Started by vtran31, February 07, 2005, 11:19 PM

Previous topic - Next topic

vtran31

   I'm trying to create a computer program for a science project that is due in a little less than 3 weeks.  The program is a schedule program that will be used by the school (hopefully).  So far, I've created a text file of classes, a text file of teachers, and a test file of students. Each one of these text files is read into the main method of a class (each text file is read into a different class) .  The end result is I have an ArrayList of classes, an ArrayList of teachers, and an ArrayList of students ( sucky progression of thought but the best I could do).
   Right now I have two main hurdles. 
      1)I need to find someway to access a variable created in main ().  The variable is the ArrayList of classes, named "all", which another method, findSchoolClass() , of my class needs to use.  I can't seem to be able to call main or pass a parameter from main() to the  method.  findSchoolClass() . Help?
      2) I do not know how to make it so that the classes are more balanced (so that one History class does not have 10 students while another has 30 students).  This is the crux of my program and the purpose of my "science project". but I am stumped on what math equation or computer algorithm I need to use to balance my school classes.  Does anyone have any sort of idea of what I can do?

      3 weeks to see if all my time put into this amounted to anything.  Time to get lots of Java :-P

The-FooL

For the first one, a possibility is to make a static class with static variables.  Then your other classes can all access this static class(including your arraylist).

For the second, just assign one student at a time to a class, to the class with the least amount of people.

MyndFyre

Quote from: The-FooL on February 09, 2005, 04:24 PM
For the first one, a possibility is to make a static class with static variables.  Then your other classes can all access this static class(including your arraylist).

That is hardly the most effective way to do it object-orientedly speaking.  You don't call main(), it is called from the command line when you type "java MyProgramClassThatHasAMethodCalledmain".  Generally you'll be dealing with a program loop within main -- perhaps a do...while(expr) type of statement, and then let your objects do the work?

This is the kind of project that needs planning.  Why are you using Java if you're not trying to use OOP?
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.