小弟是刚刚开始学c#的,有一个程序题目,题中给出了程序的框架结构和运行结果,小弟实在是想不出,请大家帮忙完成,提前感谢。
题目给出的程序框架是:
using System;
using System.Collections.Generic;
using System.Text;
namespace c
{
class Point
{
public int x;
public int y;
public Point(int nx, int ny)
{ }
public Point(Point n)
{ }
public void Set(int nx, int ny)
{ }
public void Set(Point n)
{ }
public int getx()
{ }
public int gety()
{ }
}
class Class1
{
private int side;
private Point location;
public Class1(Point location,int length)
{ }
public void Class(Point center,int length)
{ }
public void graph(Point center,int length)
{ }
public int getarea()
{ }
public int getperimeter()
{ }
public int getlength()
{ }
public Point getlocation()
{ }
}
class program
{
static void Main(string[] args)
{
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());
}
}
}
要求的运行结果是:
请输入正方形的边长及位置:
边长:6
位置:5
0
* * * * * *
* *
* *
* *
* *
* * * * * *
Square:
Length=6
Location=5,0
Perimeter=24
Area=36
Press any key to continue
[此贴子已经被作者于2007-9-14 21:47:05编辑过]