TvTian
TvTian
采纳率0%
2017-09-27 05:04 阅读 1.3k

关于JAVA的类,小程序Applet怎样输出?附代码

package c4a;
import java.applet.Applet;
import java.awt.Graphics;
import java.util.*;
class shuxing{
public int a;
public int b;
public int c;
double m; //面积
double h; //周长
 public void show(Graphics g,int x,int y)
 {
  double p=0.5*(a+b+c);
  double s=Math.sqrt(p*(p-a)*(p-b)*(p-c));
  g.drawString("周长:"+(a+b+c), x, y);
  g.drawString("面积:"+(s), x, y+20);
 }
}
public class sanjiao extends Applet {
 public void paint(Graphics g)
 {
  Scanner aa=new Scanner(System.in);
  int a1=aa.nextInt();
  int b1=aa.nextInt();
  int c1=aa.nextInt();
  shuxing A=new shuxing();
  A.a=a1;
  shuxing B=new shuxing();
  B.b=b1;
  shuxing C=new shuxing();
  C.c=c1;
  shuxing h=new shuxing();
 }
}

问题是:怎样才能输出周长和面积

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • qq_28492919 qq_28492919 2017-09-27 06:55

    system.out.println();

    点赞 评论 复制链接分享

相关推荐