예제 #1
0
 /// <summary>
 /// Accept method for the input data visitor.
 /// </summary>
 /// <param name="visitor">Visitor.</param>
 public override void Accept(IVisitor visitor)
 {
     visitor.Visit(this);
     Term1.Accept(visitor);
     Term2.Accept(visitor);
     visitor.PostVisit(this);
 }
예제 #2
0
        private void AddCourseToTerm()
        {
            Console.WriteLine("What's the name of this course?");
            String newCourseName = Console.ReadLine();

            newCourseName.ToLower();
            Course newUserCourse = new Course(newCourseName);

            try
            {
                Term1.AddCourse(newUserCourse);
            }
            catch (PreExistingCourseException)
            {
                Console.WriteLine("This course already exists in this term! Please try again...");
            }

            Console.WriteLine("The course has been added!");
            DisplayCourseOptions();

            String key = Console.ReadLine();

            key.ToUpper();
            Course1 = newUserCourse;

            if (key.Equals("J"))
            {
                Process(key);
            }
        }
예제 #3
0
 /// <summary>
 /// Adds its two terms together, evaluating those two terms as necessary.
 /// </summary>
 /// <param name="rng">The rng to use, passed to other terms.</param>
 /// <returns>The result of adding <see cref="Term1"/> and <see cref="Term2"/>.</returns>
 public int GetResult(IGenerator rng)
 {
     return(Term1.GetResult(rng) + Term2.GetResult(rng));
 }
예제 #4
0
 /// <summary>
 /// Divides the first term by the second, evaluating those two terms as necessary.
 /// </summary>
 /// <param name="rng">The rng to used -- passed to other terms.</param>
 /// <returns>The result of evaluating <see cref="Term1"/> / <see cref="Term2"/>.</returns>
 public int GetResult(IGenerator rng)
 {
     return((int)Math.Round((double)Term1.GetResult(rng) / Term2.GetResult(rng)));
 }
예제 #5
0
 /// <summary>
 /// Subtracts the second term from the first, evaluating those two terms as necessary.
 /// </summary>
 /// <param name="rng">The rng to used -- passed to other terms.</param>
 /// <returns>The result of evaluating Term1 - Term2.</returns>
 public int GetResult(IRandom rng)
 {
     return(Term1.GetResult(rng) - Term2.GetResult(rng));
 }
예제 #6
0
 /// <summary>
 /// Divides the first term by the second, evaluating those two terms as necessary.
 /// </summary>
 /// <param name="rng">The rng to used -- passed to other terms.</param>
 /// <returns>The result of evaluating Term1 / Term2.</returns>
 public int GetResult(IRandom rng)
 {
     return((int)Math.Round((double)Term1.GetResult(rng) / Term2.GetResult(rng)));
 }