Esempio n. 1
0
        public bool Run(IProcessorStorage storage)
        {
            ICalcIO     calcIO     = storage.CalcIO;
            IMathBuffer mathBuffer = storage.Maths;

            mathBuffer.TempValue = storage.InputParser.ReadDouble();
            mathBuffer.AccValue += mathBuffer.TempValue;
            mathBuffer.SaveAccValue();

            return(true);
        }
        public bool Run(IProcessorStorage storage)
        {
            ICalcIO     calcIO     = storage.CalcIO;
            IMathBuffer mathBuffer = storage.Maths;

            int input = storage.InputParser.ReadInt(x => (x > 0 && x <= mathBuffer.Values.Count));

            mathBuffer.TempValue = input;
            mathBuffer.AccValue  = mathBuffer.Values[input - 1];
            mathBuffer.SaveAccValue();

            return(true);
        }
Esempio n. 3
0
        public bool Run(IProcessorStorage storage)
        {
            ICalcIO     calcIO     = storage.CalcIO;
            IMathBuffer mathBuffer = storage.Maths;

            double input = storage.InputParser.ReadDouble();

            while (input == 0)
            {
                calcIO.WriteLine(new DivideByZeroException().Message);
                input = (calcIO as ICalcInputParser).ReadDouble();
            }

            mathBuffer.TempValue = input;
            mathBuffer.AccValue /= input;
            mathBuffer.SaveAccValue();

            return(true);
        }