Пример #1
0
        public void RangeReport()
        {
            // Sample Case Question 2 goes here
            double min   = emplTimes[0].GetBillTime();
            double max   = emplTimes[0].GetBillTime();
            double sum   = emplTimes[0].GetBillTime();
            double count = 1;

            for (int i = 1; i < EmplTime.GetCount(); i++)
            {
                if (emplTimes[i].GetBillTime() < min)
                {
                    min = emplTimes[i].GetBillTime();
                }
                if (emplTimes[i].GetBillTime() > max)
                {
                    max = emplTimes[i].GetBillTime();
                }
                sum += emplTimes[i].GetBillTime();
                count++;
            }
            double range   = max - min;
            double average = sum / count;

            Console.WriteLine($"The range is {range}.  The average is {average}");
        }
Пример #2
0
        public EmplTime[] GetAllEmplTime()
        {
            EmplTime[] myArray = new EmplTime[100];
            //Open
            StreamReader inFile = new StreamReader(fileName);

            //Process
            string input = inFile.ReadLine(); // priming read

            while (input != null)
            {
                string[] temp          = input.Split('#');
                double   tempBillTime  = double.Parse(temp[2]);
                double   tempAdmimTime = double.Parse(temp[3]);
                double   billPercent   = tempBillTime / (tempBillTime + tempAdmimTime);
                myArray[EmplTime.GetCount()] = new EmplTime(temp[0], temp[1], tempBillTime, tempAdmimTime, billPercent);
                EmplTime.IncCount();

                //update Read
                input = inFile.ReadLine();
            }

            //Close
            inFile.Close();

            return(myArray);
        }
Пример #3
0
        public void BillPercentByDept()
        {
            //Sample Case Question 3 goes here
            double sum      = emplTimes[0].GetBillPercent();
            int    count    = 1;
            string currDept = emplTimes[0].GetDept();

            for (int i = 1; i < EmplTime.GetCount(); i++)
            {
                if (emplTimes[i].GetDept() == currDept)
                {
                    sum += emplTimes[i].GetBillPercent();
                    count++;
                }
                else
                {
                    ProcessBreak(ref currDept, ref sum, ref count, i);
                }
            }

            ProcessBreak(ref currDept, ref sum, ref count, 0);
        }