Friday, March 30, 2012

Oh, What's the Point?

Ha, ha, I made a punny

No, it doesn't work yet, but I'm still at it.  Now I have to finish it or my failure will be forever entombed in internet archives...

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

namespace Exercise_7_4
{
    class Point
    {
        public int x;
        public int y;

        public Point(int x, int y)
        {
            this.x = x;
            this.y = y;
        }

        public void DisplayPoint()
        {
            Console.WriteLine("Point at ({0},{1})", x, y);
        }
    }

    class Square
    {
        Point topLeft;
        Point topRight;
        Point bottomLeft;
        Point bottomRight;

        public Square(Point startingPoint, int sideLength)
        {
            this.topLeft.x = startingPoint.x;
            this.topLeft.y = startingPoint.y;
            this.topRight.x = startingPoint.x + sideLength;
            this.topRight.y = startingPoint.y;
            this.bottomLeft.x = startingPoint.x;
            this.bottomLeft.y = startingPoint.y - sideLength;
            this.bottomRight.x = startingPoint.x + sideLength;
            this.bottomRight.y = startingPoint.y - sideLength;
        }

        public void DisplaySquare()
        {
            Console.WriteLine("I don't know what to put in DisplaySquare yet.");
        }

    }
   
    class Program
    {
        static void Main(string[] args)
        {
            Point myPoint = new Point(3, 4);
            myPoint.DisplayPoint();

            Square mySquare = new Square(myPoint, 5);
            mySquare.DisplaySquare();

            //to keep console window open to view output
            Console.ReadLine();
        }
    }
}


Still trying... :)

No comments:

Post a Comment

Comments? Questions? Complaints? Coladas?