static void Main(string[] args) { FuelCalculator fc = new FuelCalculator(); Console.WriteLine($"Needed Fuel amount: {fc.NeededFuelTotal}"); Console.WriteLine($"Required Fuel amount: {fc.RequiredFuelTotal}"); }
static void Main(string[] args) { var inputFilePath = args[0]; string[] lines = System.IO.File.ReadAllLines(inputFilePath); int totalFuel = 0; var fuelCalculator = new FuelCalculator(); lines.ToList().ForEach(x => totalFuel += fuelCalculator.GetTotalRequiredFuel(int.Parse(x))); Console.WriteLine($"Total Fuel Required: {totalFuel}"); }
static List <int> LoadFuelCalculations() { var calculations = new List <int>(); var masses = new List <int>(); string line = string.Empty; System.IO.StreamReader file = new System.IO.StreamReader(@"input.txt"); while ((line = file.ReadLine()) != null) { masses.Add(int.Parse(line)); } file.Close(); Parallel.ForEach(masses, mass => { calculations.Add(FuelCalculator.DetermineFuelTotal(mass)); }); return(calculations); }
public void FuelCalculationRecursively(int input, int expectedOutput) { Assert.That(FuelCalculator.CalculateRecursivly(input), Is.EqualTo(expectedOutput)); }
public void FuelCalculations(int input, int expectedOutput) { Assert.That(FuelCalculator.Calculate(input), Is.EqualTo(expectedOutput)); }