public int DoubleNumberOfTimes(int myInt, int numberOfTimes) { HandsOn1 handsOn1 = new HandsOn1(); Console.WriteLine("Old value: " + myInt + " Number of Times: " + numberOfTimes); int doubledTimes = myInt, i = 0; if (numberOfTimes <= 0) { Console.WriteLine("Invalid Number of Times value!"); return(myInt); } else { i = numberOfTimes; } while (i-- > 0) { doubledTimes = handsOn1.DoubleMe(doubledTimes, true); } Console.WriteLine("New value: " + doubledTimes); return(doubledTimes); }
public int QuadrupleMe(int myInt) { Console.WriteLine("Old value: " + myInt); HandsOn1 handsOn = new HandsOn1(); int quadruple = handsOn.DoubleMe(handsOn.DoubleMe(myInt, true), true); Console.WriteLine("New value: " + quadruple); return(quadruple); }