Ejemplo n.º 1
0
        public int Grade(int count)
        {
            int track = 0;
            int sum   = 0;
            int val   = 0;
            int grade;

            while (track < count)
            {
                Console.WriteLine("Input Test Score");
                val = int.Parse(Console.ReadLine());
                if ((val >= 0) && (val <= 100))
                {
                }
                else
                {
                    Console.WriteLine("Incorrect number input");
                    val = 0;
                    track--;
                }
                sum = sum + val;
                track++;
            }

            grade = sum / count;
            SumFirst gradeSum = new SumFirst();

            gradeSum.TotalGrade(grade);
            return(grade);
        }
Ejemplo n.º 2
0
        public int Grade(int track)
        {
            int grade = 0;
            int val   = 0;

            track = 0;
            int sum     = 0;
            int checker = 1;

            while (checker == 1)
            {
                sum = sum + val;
                Console.WriteLine("Input scores");
                val = int.Parse(Console.ReadLine());
                if ((val >= 0) && (val <= 100))
                {
                }
                else
                {
                    Console.WriteLine("Incorrect number input");
                    val = 0;
                    track--;
                }
                track++;
                Console.WriteLine("Are there more tests?");
                string prompt = "Options:\n\t1 - Yes\n\t2 - No\nChoice: ";

                Console.WriteLine(prompt);
                checker = int.Parse(Console.ReadLine());
            }

            grade = sum / track;
            SumFirst gradeSum = new SumFirst();

            gradeSum.TotalGrade(grade);
            return(grade);
        }