Quantcast

Maximum PC

It is currently Wed Jul 30, 2014 8:46 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: help creating a scheduling program with java
PostPosted: Tue May 12, 2009 7:31 pm 
Klamath
Klamath
User avatar

Joined: Sat Sep 04, 2004 2:23 pm
Posts: 330
Location: The oc
Hi guys,

I'm working on a java project for one of my programming classes. Our task is to create a basic scheduling program for a university. So we have three main components: classrooms, courses and students. Each have their own attributes (i.e. classroom name, course name, course id, capacity, student name, student id etc etc...). For those who have experience with object-oriented programming, what's the best way to store these? Any other architecture ideas are welcome!

So far I have two paths to consider:
1. creating a Classroom object, for instance, and storing them in an array
2. creating a bunch of hashmaps that store the 'key' and a corresponding attribute

Thanks!


Top
  Profile  
 
 Post subject: Re: help creating a scheduling program with java
PostPosted: Wed May 13, 2009 3:40 am 
SON OF A GUN
SON OF A GUN
User avatar

Joined: Mon Nov 01, 2004 5:41 am
Posts: 11605
Air Jordan wrote:
For those who have experience with object-oriented programming, what's the best way to store these?


Wut? Here is a skeleton (C#). Without more info about what the data looks like, what functions you need to accomplish I can't say much else. What are you going to use the hashmaps for? Do you mean like a basic hash table?

I don't know what the assignment is supposed to do... I can't comment on your "approaches".

Code:
namespace scheduling
{
   // if this is a base class, you might change it to protected (I think).
   // because in this case, you won't ever have a "person" object that isn't
   // a teacher or a student.
   public class Person
   {
      private string _FirstName;
      private string _LastName;
      
      // Other common "person" attributes, address, phone, etc.
      
      // Create your public get and set functions
      public string FirstName
      {
         get { return _FirstName;}
         set { _FirstName = value;}
      }
      
      // Constructor
      
      // functions
   }
   
   public class Teacher : Person
   {
      private string _Department;
      private string _EmployeeID; //guid? int? whatever it is use the appropriate datatype
      private int _YearsOfService;
   
      // Ditto
   }
   
   public class Student : Person
   {
      private string _Major;
      private string _Minor;
      private string _StudentID;
      
      // Ditto
   }
}


Top
  Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group