Java shape class not passing | Sololearn: Learn to code for FREE!

0

Java shape class not passing

Dear all, I have done the java test tutorial it is passing g the test case but problem is this session not completed is there any issues of my code import java.util.Scanner; abstract class Shape { int width; public void setValue(int width) {this.width = width; } public int getWidth() { return width; } abstract double area(); } //your code goes here class Circle extends Shape{ public double area (){ return getWidth() * getWidth()*Math.PI; } } class Square extends Shape{ public double area(){ return getWidth() * getWidth(); } } public class Program { public static void main(String[ ] args) { Scanner sc = new Scanner(System.in); int x = sc.nextInt(); int y = sc.nextInt(); Shape sp; Square a = new Square (); sp =a; sp.setValue(x); System.out.println((int)sp.area()); Circle b = new Circle(); sp =b; sp.setValue(y); System.out.println(sp.area());}}

12/16/2020 1:38:25 PM

Gayan Suranga

3 Answers

New Answer

0

You can compare with this. https://www.sololearn.com/discuss/2605278/?ref=app https://www.sololearn.com/discuss/2603950/?ref=app

0

My programme is working all test cases passed but not allow it passed status

0

Avinesh do u have any idea about my matter all test cases passed but programme not mark as pass?