Beispiel #1
0
       /*
        * Method: FinaAvailableSlot
        * Parameters: FinalExamDay fed, CompressedClassTime ct,
        *             int startTime, int endTime
        * Output: N/A
        * Created By: Scott Smoke
        * Date: 5/4/2015
        * Modified By: Scott Smoke
        * 
        * Description: This method finds an available time slot
        * and inserts the exam into it.
        * 
        */ 
        private void FindAvailableSlot(FinalExamDay fed, CompressedClassTime ct,
            int startTime, int endTime)
        {
             while (startTime < Globals.END_OF_EXAM_DAY)
                {
                    if (fed.HasAvailableTime(startTime, endTime))
                    {
                        InsertExam(fed, ct, startTime, endTime);
                        return;
                    }
                    startTime = startTime +
                        MilitaryTime(tc.GetLengthOfExams()
                        + tc.GetTimeBetweenExams());

                    endTime = startTime +
                        MilitaryTime(tc.GetLengthOfExams()
                           + tc.GetTimeBetweenExams());
                }

        }
Beispiel #2
0
 /*
  * Method: Initiailize
  * Parameters: N/A
  * Output: N/A
  * Created By: Scott Smoke
  * Date: 5/1/2015
  * Modified By: Scott Smoke
  * 
  * Description: Initialized the exam week.
  * 
  */ 
 private void Initialize()
 {
    
     
     for (int i = 0; i < tc.GetNumberOfDays(); i++ )
     {
         examWeek[i] = new FinalExamDay();
         examWeek[i].SetDay(i+1);
         examWeek[i].SetNumberOfExams(AvailaibleTimeSlotsWithoutLp());
         if (tc.GetLunchPeriod() != 0)
         {
             FinalExam fe = new FinalExam(new CompressedClassTime("Lunch", 12));
             fe.SetStartTime(1200);
             fe.SetEndTime(1200 + MilitaryTime(tc.GetLunchPeriod()));
             examWeek[i].InsertExam(fe);
            // Debug.WriteLine(fe.GetCompressedClass().GetDayOfTheWeek());
         }
         
     }
 }
Beispiel #3
0
 /*
  * Method: InsertExam
  * Parameters: FinalExamDay fed, CompressedClassTime ct, 
  *             int startTime, int endTime
  * Output: N/A
  * Created By: Scott Smoke
  * Date: 5/3/2015
  * Modified By: Scott Smoke
  * 
  * Description: This inserts an exam into the specified
  * exam day with the specified start and end times.Notes this adds the
  * break time to the length of the exam.
  * 
  */ 
  private void InsertExam(FinalExamDay fed, CompressedClassTime ct, 
      int startTime, int endTime)
  {
      FinalExam fe = new FinalExam(ct);
     // Debug.WriteLine("Class start hour " + ct.GetClassTimeStartHour() * 100);
      fe.SetStartTime(startTime);
      fe.SetEndTime(endTime);
      fed.InsertExam(fe);
      //debugging info
      //Debug.WriteLine("Day: " + fed.GetDay().ToString() + " " 
      //    + fed.GetNumberOfExams());
  }