求救,帮帮我

using System;
class Point
{
    public int x;
    public int y;
    public Point(int nx, int ny)
    {

        x = nx; y = ny;
    }

    public Point(Point n)
    { }
    public void Set(int nx, int ny)
    { }
    public void Set(Point n)
    { }
    public int getx()
    { return x; }
    public int gety()
    { return y; }
}
class Class1
{
    private int side;
    private Point location;
    public Class1(Point location, int length)
    {
        int w; int q;

        side = length;
        w = location.getx();
        q = location.gety();


    }
    public void Class(Point center, int length)
    { }
    public void graph(Point center, int length)
    {
        int i;
        for (i = 1; i <= side; i++)
            if (i >= 2 && i <= 5)
                Console.WriteLine("*    *");
            else Console.WriteLine("******");
    }
    public int getarea()
    { return side * side; }
    public int getperimeter()
    { return side * 4; }
    public int getlength()
    { return side; }
    public Point getlocation()
    {
        //int r;int e;
        Point a = new Point();
        location = a.getx();
        return location;
    }
    static void Main()
    {
        int x, y, a;
        Console.WriteLine("请输入正方形的变长及位置:");
        Console.WriteLine("边长");
        a = int.Parse(Console.ReadLine());
        Console.WriteLine("位置");
        x = int.Parse(Console.ReadLine());
        y = int.Parse(Console.ReadLine());
        Class1 sd = new Class1(new Point(x, y), a);
        Console.WriteLine("square:");
        Console.WriteLine("length=" + sd.getlength());
        Console.WriteLine("location=" + sd.getlocation().getx() + sd.getlocation().gety());
        Console.WriteLine("perimeter=" + sd.getperimeter());
        Console.WriteLine("area=" + sd.getarea());
    }
}

这是一道C#的题目是编写一个正方形提供绘制和操作的代码。在该代码中正方开类的字段有正方形边长和窗口上正方形开始的位置;正方形类的方法有绘制正方形和返回正方形边长,开始位置,周长,面积。我已填写了一部分代码,可红色的地方我不是太懂,请各位大哥大姐帮帮我啊!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值