0

do you guys know where I am wrong?

import java.util.Scanner; abstract class Shape { int width; abstract void area(int x); } //your code goes here class Square extends Shape { public void area(int x){ width = x; width *= width; System.out.println(width); } } class Circle extends Shape { public void area(int x){ width = x; double PI = Math.PI; double areaCircle = (double) width * width * PI; System.out.println(areaCircle); } } public class Program { public static void main(String[ ] args) { Scanner sc = new Scanner(System.in); int x = sc.nextInt(); int y = sc.nextInt(); Square a = new Square(); Circle b = new Circle(); a.area(x); b.area(y); } }

13th Jun 2021, 7:37 AM
Rajshree Mishra
Rajshree Mishra - avatar
3 Answers
+ 2
Rajshree Mishra , it would be easier to help if you put your code in playground and link it here. people who like to help you don't like to copy and paste and save the file just for seeing what the problem is. it would also be great if you could give a clear and complete description of the problem. thanks for your understanding!
13th Jun 2021, 9:58 AM
Lothar
Lothar - avatar
0
Pls follow step as @Lothar said. And Try again , this should work.. Otherwise tell which test case not passing..
13th Jun 2021, 10:42 AM
Jayakrishna 🇼🇳
0
I tried the code in code playground and it works completly! seprate inputs with space. For example input 2 3
13th Jun 2021, 10:48 AM
GHOST mHBr
GHOST mHBr - avatar