fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7.  
  8. class Shape
  9. {
  10. protected float areaOfCircle;
  11. protected float areaOfRectangle;
  12.  
  13. public void PrintCircle()
  14. {
  15. System.out.print("The area of Circle: ", areaOfCircle, "\n");
  16. }
  17.  
  18. public void PrintRectangle()
  19. {
  20. System.out.print("The area of Rectangle: ", areaOfRectangle, "\n");
  21. }
  22. }
  23.  
  24. class Circle extends Shape
  25. {
  26. private float radius;
  27.  
  28. public void SetRadius( float R)
  29. {
  30. radius = R;
  31. }
  32.  
  33. public void CalculateAreaOfCircle()
  34. {
  35. areaOfCircle = 3.1417 * (r * r);
  36. }
  37.  
  38. public void PrintCircle()
  39. {
  40. super.PrintCircle();
  41. }
  42. }
  43.  
  44. class Rectangle extends Shape
  45. {
  46. private float width;
  47. private float length;
  48.  
  49. public void SetWidth( float w)
  50. {
  51. width = w;
  52. }
  53.  
  54. public void SetLength( float l)
  55. {
  56. length = l;
  57. }
  58.  
  59. public void CalculateAreaOfRectangle()
  60. {
  61. areaOfRectangle = w * l;
  62. }
  63.  
  64. public void PrintRectangle()
  65. {
  66. super.PrintRectangle();
  67. }
  68. }
  69. /* Name of the class has to be "Main" only if the class is public. */
  70. class Ideone
  71. {
  72. public static void main (String[] args) throws java.lang.Exception
  73. {
  74. // your code goes here
  75. }
  76. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:15: error: no suitable method found for print(String,float,String)
		System.out.print("The area of Circle: ", areaOfCircle, "\n");
		          ^
    method PrintStream.print(boolean) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.print(char) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.print(int) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.print(long) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.print(float) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.print(double) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.print(char[]) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.print(String) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.print(Object) is not applicable
      (actual and formal argument lists differ in length)
Main.java:20: error: no suitable method found for print(String,float,String)
		System.out.print("The area of Rectangle: ", areaOfRectangle, "\n");
		          ^
    method PrintStream.print(boolean) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.print(char) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.print(int) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.print(long) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.print(float) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.print(double) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.print(char[]) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.print(String) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.print(Object) is not applicable
      (actual and formal argument lists differ in length)
Main.java:35: error: cannot find symbol
		areaOfCircle = 3.1417 * (r * r);
		                         ^
  symbol:   variable r
  location: class Circle
Main.java:35: error: cannot find symbol
		areaOfCircle = 3.1417 * (r * r);
		                             ^
  symbol:   variable r
  location: class Circle
Main.java:61: error: cannot find symbol
		areaOfRectangle = w * l;
		                  ^
  symbol:   variable w
  location: class Rectangle
Main.java:61: error: cannot find symbol
		areaOfRectangle = w * l;
		                      ^
  symbol:   variable l
  location: class Rectangle
6 errors
stdout
Standard output is empty