Exemple #1
0
 public AstronomicalObject(string[] values)
 {
     Name = values[0];
     Mass = new ExponentionalValues(
         float.Parse(values[1]),
         int.Parse(values[2]),
         SIUnitConverter.StringToSIUnit(values[3])
         );
     Radius = new ExponentionalValues(
         float.Parse(values[4]),
         int.Parse(values[5]),
         SIUnitConverter.StringToSIUnit(values[6])
         );
     CalculateIntensityOfGravityAtSurface();
 }
Exemple #2
0
        private ExponentionalValues CheckMassUnits()
        {
            switch (Mass.units)
            {
            case SIUnit.kg:
                return(Mass);

            case SIUnit.SolarMass:
                return(SIUnitConverter.SolarMassToKG(Mass));

            default:
                System.Diagnostics.Debug.Write("\n-----------\n");
                System.Diagnostics.Debug.Write(Name + ".Mass.units was assigned an invalid value: ["
                                               + Mass.units.ToString() + "]");
                System.Diagnostics.Debug.Write("\n-----------\n");
                return(Mass);
            }
        }
Exemple #3
0
        private ExponentionalValues CheckRadiusUnits()
        {
            switch (Radius.units)
            {
            case SIUnit.m:
                return(Radius);

            case SIUnit.km:
                return(SIUnitConverter.KilometersToMeters(Radius));

            default:
                System.Diagnostics.Debug.Write("\n-----------\n");
                System.Diagnostics.Debug.Write(Name + ".Radius.units was assigned an invalid value: ["
                                               + Radius.units.ToString() + "]");
                System.Diagnostics.Debug.Write("\n-----------\n");
                return(Radius);
            }
        }