프로그래밍/C#
홍대 자바 수업 원주 ,넓이 구하는거-C# 생성자 사용 ..
Yi Junho
2009. 7. 20. 16:10
반응형
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class CirTest
{
private double r;
double temp;
public CirTest(double a)
{
this.r = a;
}
public double setR(double a)
{
r = a;
return r;
}
public double rCal()
{
temp = r * 6.28;
return temp;
}
public double r2Cal()
{
temp = r * r * 3.14;
return temp;
}
}
class Circle
{
public static void Main(String[] args)
{
CirTest jh=new CirTest(10);
Console.WriteLine("넓이는"+jh.r2Cal());
Console.WriteLine("원주는"+jh.rCal());
}
}
}반응형