I am working on a project:
For this project, you’ll create a form that lets the user move a simple
robot a given direction and distance. You’ll also create a class that
performs the robot movements.

The robot is displayed as an arrow that points in the currently selected
direction.

The user can move the robot 1 or 10 units in the selected direction by
clicking the Go 1 or Go 10 button.

The robot’s current X, Y position is displayed in a label at the top of the
form.
Specifications
Create a class named Robot that has a method that causes the robot to
move, a public field that contains the current direction, and a property that
returns the robot’s current position as a Point structure. When the robot is
instantiated, the position should be set to 0, 0 (the center) and the direction
should be set to North.


Limit the range of the robot to 100 units in any direction. If the user
attempts to move the robot beyond this range, the Robot class should raise
an event. The application should respond to this event by displaying an
appropriate message.

so far I am working on the Class portion and I have:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RobotCS
{
    class Robot
    {
         public enum Direction
        {
            North, West, South, East
        }
        public Robot() // Default constructor
        {
            location = new Point(); // Sets location.X=0 and location.Y=0          
            direction = Direction.North;
        }
        public Direction direction { get; set; }

        public Point location { get; set; }

        public void Move(int unitToMove)        
        {
            Point P = new Point();
            switch (direction)
            {
                case Direction.North:
                    P.X = location.X;
                    P.Y = location.Y - unitToMove;
                    break;
                case Direction.West:
                    P.X = location.X - unitToMove;
                    P.Y = location.Y;
                    break;
                case Direction.South:
                    P.X = location.X;
                    P.Y = location.Y + unitToMove;
                    break;
                case Direction.East:
                    P.X = location.X + unitToMove;
                    P.Y = location.Y;
                    break;
                default:
                    break;
            }
            location = P;
        } 
    }
  }

but Point keeps coming up as an error "namespace point cannot be found" any and all help would be great!
-Crima

This article has been dead for over six months. Start a new discussion instead.