/// <summary> /// Initializes a new instance of the <see cref="SpecificGravityOfSolids"/> class. Uses <see cref="UnitWeightOfWaterAt4DegreesC" /> as reference. /// </summary> /// <param name="solidUnitWeight">Calculation for gamma_s/gamma_0.</param> public SpecificGravityOfSolids(UnitWeightOfSolids solidUnitWeight) { this.Symbol = "G_s"; UnitWeightOfWaterAt4DegreesC referenceWeight = new UnitWeightOfWaterAt4DegreesC(); this.NumericValue = solidUnitWeight.NumericValue / BaseUnitWeightScalar.ConvertToUnits(referenceWeight, solidUnitWeight.UnitOfMeasure).NumericValue; }
/// <summary> /// Initializes a new instance of the <see cref="MassSpecificGravity"/> class. Uses <see cref="UnitWeightOfWaterAt4DegreesC" /> as reference. /// </summary> /// <param name="totalUnitWeight">Calculation for gamma_t/gamma_0.</param> public MassSpecificGravity(TotalUnitWeight totalUnitWeight) { this.Symbol = "G_m"; UnitWeightOfWaterAt4DegreesC referenceWeight = new UnitWeightOfWaterAt4DegreesC(); this.NumericValue = totalUnitWeight.NumericValue / BaseUnitWeightScalar.ConvertToUnits(referenceWeight, totalUnitWeight.UnitOfMeasure).NumericValue; }
public void Constructor1ShouldStoreAndPrintValueAndSymbol() { UnitWeightOfWaterAt4DegreesC uww4d = new UnitWeightOfWaterAt4DegreesC(); String correctAnswer = "𝛾_0 = 1 g/cc"; Assert.AreEqual("𝛾_0", uww4d.Symbol); Assert.AreEqual(uww4d.NumericValue, 1); Assert.AreEqual(correctAnswer, uww4d.ToString()); }
static void PrintUnitWeights() { Console.BackgroundColor = ConsoleColor.White; Console.ForegroundColor = ConsoleColor.Cyan; Console.Clear(); Console.WriteLine("Unit Weights"); Console.WriteLine("Pick a number:"); Console.WriteLine("1. Density"); Console.WriteLine("2. Total Unit Weight"); Console.WriteLine("3. Unit Weight of Solids"); Console.WriteLine("4. Unit Weight of Water"); Console.WriteLine("5. Unit Weight of Common Substances"); Console.WriteLine("6 or [else]. End Program."); string selection = Console.ReadLine(); try { int numSelect = int.Parse(selection); switch (numSelect) { case 1: DoCalculationsForType(typeof(Density)); break; case 2: DoCalculationsForType(typeof(TotalUnitWeight)); break; case 3: DoCalculationsForType(typeof(UnitWeightOfSolids)); break; case 4: DoCalculationsForType(typeof(UnitWeightOfWater)); break; case 5: UnitWeightOfWaterAt4DegreesC four = new UnitWeightOfWaterAt4DegreesC(); Console.WriteLine("The nominal unit weight of water at 4 degrees C is " + four); break; default: break; } } catch { } Console.WriteLine("Press any key to continue..."); Console.ReadKey(); }