fork(1) download
  1. interface calcFigure{
  2. double calcArea( double x, double y );
  3. double calcVolume( double x, double y, double z );
  4. }
  5. //(ここを作成)
  6. class CalcShape{
  7. public static void main( String [] args ){
  8. Triangle tr = new Triangle();
  9. Rectangle rc = new Rectangle();
  10.  
  11. double x = Double.parseDouble( args[0] ); // 底面の1辺の長さ(△の底辺の長さ)
  12. double y = Double.parseDouble( args[1] ); // 底面のもう1辺の長さ(△の高さ)
  13. double z = Double.parseDouble( args[2] ); // 立体の高さ
  14.  
  15. System.out.printf("三角形の面積:%.1f\n", tr.calcArea(x,y));
  16. System.out.printf("三角錐の体積:%.1f\n", tr.calcVolume(x,y,z));
  17. System.out.printf("四角形の面積:%.1f\n", rc.calcArea(x,y));
  18. System.out.printf("直方体の体積:%.1f\n", rc.calcVolume(x,y,z));
  19. }
  20. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:8: error: cannot find symbol
		Triangle tr = new Triangle();
		^
  symbol:   class Triangle
  location: class CalcShape
Main.java:8: error: cannot find symbol
		Triangle tr = new Triangle();
		                  ^
  symbol:   class Triangle
  location: class CalcShape
Main.java:9: error: cannot find symbol
		Rectangle rc = new Rectangle();
		^
  symbol:   class Rectangle
  location: class CalcShape
Main.java:9: error: cannot find symbol
		Rectangle rc = new Rectangle();
		                   ^
  symbol:   class Rectangle
  location: class CalcShape
4 errors
stdout
Standard output is empty