示例#1
0
 public void CalculateNewSpeed(int fuel)
 {
     SetSpeed(GetSpeed() + 50 - fuel);
     SetFuel(GetFuel() - fuel);
     SetHeight(GetHeight() - speed);
     mlh.AddRound(GetHeight(), GetSpeed());
 }
示例#2
0
        // adjust speed, fuel, and height
        public void CalculateNewSpeed(int nFuel)
        {
            speed   = (speed + 50 - nFuel);
            height -= speed;

            // to keep from getting a height that's negative
            if (height < 0)
            {
                height = 0;
            }
            fuel -= nFuel;
            mlh.AddRound(height, speed);
        }
示例#3
0
        public int calcNewSpeedHeight(int input)
        {
            mlh.AddRound(height, speed);

            int newSpeed;

            newSpeed = getSpeed() + 50 - input;

            setSpeed(newSpeed);
            reduceFuel(input);
            setHeight(getHeight() - getSpeed());


            return(newSpeed);
        }
        // you'll need to add data fields & methods so that the rest of the program
        // can use the various properties of the lander (such as height, speed, etc)


        public MarsLander()
        {
            mlh.AddRound(height: initialHeight, speed: intitialSpeed);
            current = mlh.Last();
        }