package jihe;
import java .util.*;
import java.awt.geom.Area;
import java .lang.*;
import java.util.Scanner;
public class Jihe{
int a;/*基本几何图形的边长*/
int b;/*基本几何图形的边长*/
double r;/*圆半径*/
int c;/*基本几何图形的边长*/
public Jihe() {
this.a = a;
this.b = b;
this.c = c;
this.r = r;
}/*利用构造函数初始化成员字段*/
}
public class Triangle extends Jihe{
super(a,b,c);
public double Area() {
double S;
double p;
p=(a+b+c)/2;
S=Math.sqrt(p*(p-a)*(p-b)*(p-c));
return S;
}
public int Zhouchang(){
int C;
C=a+b+c;
return C;
}
}
public class Circle extends Jihe{
super.r=r;
public double Area() {
double S;
S=Math.PI*r*r;
}
public double Zhouchang() {
double C;
C=Math.PI*2*r;
return C;
}
}
public class Rectangle extends Jihe{
super(a,b);
public int Area() {
int S;
S= a*b;
return S;
}
public int Zhouchang(){
int C;
C=2*(a+b);
return C;
}
}
public class Test {
public static void main(String[] args) {
System.out.println("请选择要计算的基本图形/n1、三角形。2、圆形3、矩形");
int choose;
Scanner sc =new Scanner(System.in);
choose =sc.nextInt();
switch(choose){
case 1:System.out.println("请输入三角形的三边");
Jihe J = new Jihe();
Scanner qw =new Scanner(System.in);
int a,b,c;
a = qw.nextInt();
b = qw.nextInt();
c = qw.nextInt();
Triangle T= new Triangle(a,b,c);
System.out.println(S"+"C);
}
}
}
import java .util.*;
import java.awt.geom.Area;
import java .lang.*;
import java.util.Scanner;
public class Jihe{
int a;/*基本几何图形的边长*/
int b;/*基本几何图形的边长*/
double r;/*圆半径*/
int c;/*基本几何图形的边长*/
public Jihe() {
this.a = a;
this.b = b;
this.c = c;
this.r = r;
}/*利用构造函数初始化成员字段*/
}
public class Triangle extends Jihe{
super(a,b,c);
public double Area() {
double S;
double p;
p=(a+b+c)/2;
S=Math.sqrt(p*(p-a)*(p-b)*(p-c));
return S;
}
public int Zhouchang(){
int C;
C=a+b+c;
return C;
}
}
public class Circle extends Jihe{
super.r=r;
public double Area() {
double S;
S=Math.PI*r*r;
}
public double Zhouchang() {
double C;
C=Math.PI*2*r;
return C;
}
}
public class Rectangle extends Jihe{
super(a,b);
public int Area() {
int S;
S= a*b;
return S;
}
public int Zhouchang(){
int C;
C=2*(a+b);
return C;
}
}
public class Test {
public static void main(String[] args) {
System.out.println("请选择要计算的基本图形/n1、三角形。2、圆形3、矩形");
int choose;
Scanner sc =new Scanner(System.in);
choose =sc.nextInt();
switch(choose){
case 1:System.out.println("请输入三角形的三边");
Jihe J = new Jihe();
Scanner qw =new Scanner(System.in);
int a,b,c;
a = qw.nextInt();
b = qw.nextInt();
c = qw.nextInt();
Triangle T= new Triangle(a,b,c);
System.out.println(S"+"C);
}
}
}