# Java 实验5

/*
* @(#)Circle
*
* Copyright 2008 School of Software, Yunnan University.
*/
package cn.edu.ynu.sei.Java_Labs.Lab5;

/**
* 实验5 根据给出的圆的半径计算该圆的直径和面积
* 本程序计算时采用的圆周率为3.14
* @version 1.0.0.0 Jan 24, 2008
* @author eleven
*/
public class Circle {

/**
* 设置半径
*/
}

/**
* 获取半径
*/
}

/**
* 计算直径
*/
double diameter = 2 * Radius;
return diameter;
}

/**
* 计算面积
*/
return area;
}

public static void main(String[] args) {
Circle c = new Circle();
System.out.println("The diameter of a is " + diameter1);
System.out.println("The area of a is " + area1);

System.out.println("The diameter of b is " + diameter2);
System.out.println("The area of b is " + area2);
}
}

------------------------

/*
* @(#)CircleTest
*
* Copyright 2008 School of Software, Yunnan University.
*/
package cn.edu.ynu.sei.Java_Labs.Lab5;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;

/**
*
* @version 1.0.0.0 Jan 24, 2008
* @author eleven
*/
public class CircleTest {

public CircleTest() {
}

@BeforeClass
public static void setUpClass() throws Exception {
}

@AfterClass
public static void tearDownClass() throws Exception {
}

@Before
public void setUp() {
}

@After
public void tearDown() {
}

/**
* Test of getRadius method, of class Circle.
*/
@Test
Circle instance = new Circle();
}

/**
* Test of setRadius method, of class Circle.
*/
@Test
Circle instance = new Circle();
}

/**
* Test of computeDiameter method, of class Circle.
*/
@Test
public void computeDiameter() {
System.out.println("computeDiameter");
Circle instance = new Circle();
double expResult = 20.0;
assertEquals(expResult, result);
}

/**
* Test of computeArea method, of class Circle.
*/
@Test
public void computeArea() {
System.out.println("computeArea");
Circle instance = new Circle();
double expResult = 314.0;
assertEquals(expResult, result);
}

/**
* Test of main method, of class Circle.
*/
@Test
public void main() {
System.out.println("main");
String[] args = null;
Circle.main(args);
}
}

• 广告
• 抄袭
• 版权
• 政治
• 色情
• 无意义
• 其他

120