/// <summary> /// Read input and print out river flow. /// </summary> static void getRiverFlow() { int section = getSection(); double[] width = getItemArray("What is the width of each section?", section); double[] depth = getItemArray("What is the depth of each section?", section); double[] velocity = getItemArray("What is the velocity of each section?", section); RiverFlow rf = new RiverFlow(section, width, depth, velocity); double riverFlow = rf.CalculateRiverFlow(); Console.WriteLine("River Flow is : {0}", riverFlow); }
public void testWithSingleData() { Console.WriteLine("Single data test:"); try { int section = testSingleData.getSection(); double[] width = testSingleData.getWidth(); double[] depth = testSingleData.getDepth(); double[] velocity = testSingleData.getVelocity(); double expected = testSingleData.getExpected(); RiverFlow rf = new RiverFlow(section, width, depth, velocity); double riverFlow = rf.CalculateRiverFlow(); printTestInfo(section, width, depth, velocity, expected, riverFlow); if (riverFlow != expected) { throw new Exception("Not expected: testWithSingleData"); } } catch (Exception) { return; } Console.WriteLine("Single data test is done...\n"); }