O'Reilly logo

C# 7 and .NET Core Cookbook by Dirk Strauss

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

  1. Create a new class called LaunchSuttle. Then, add the following private variables to the class for engine thrust, the mass of the shuttle, the local gravitational acceleration, the constant values for the gravity of the Earth, Moon, and Mars (these are constants because they will never change), the universal gravitational constant, and an enumerator for the planet we are dealing with:
        public class LaunchShuttle         {           private double _EngineThrust;           private double _TotalShuttleMass;           private double _LocalGravitationalAcceleration;           private const double EarthGravity = 9.81;           private const double MoonGravity = 1.63;           private const double MarsGravity = 3.75;           private double UniversalGravitationalConstant;  public enum Planet { ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required