当前所在位置:珠峰网资料 >> 计算机 >> 计算机等级考试 >> 正文
计算机二级辅导:java小代码计算矩形的面积和周长
发布时间:2010/3/13 9:31:59 来源:城市学习网 编辑:MOON
  class Ractangle {
  double width;
  double height;
  public Ractangle(double w,double h){
  width=w;
  height=h;
  }
  void Area(){
  System.out.println( width*height);
  }
  void perimeter(){
  System.out.println(2*(width+height));
  }
  }
  public class RectangleDemo {
  public static void main(String args){
  Ractangle ractangle=new Ractangle(40,50);
  ractangle.Area();
  ractangle.perimeter();
  }
  }
  :
广告合作:400-664-0084 全国热线:400-664-0084
Copyright 2010 - 2017 www.my8848.com 珠峰网 粤ICP备15066211号
珠峰网 版权所有 All Rights Reserved