Help me please! | Sololearn: Learn to code for FREE!


Help me please!

import java.util.Scanner; abstract class Shape { int width; abstract void area(); } //введите код сюда public class Square extends Shape{ public Square (int x){ width =x; } void area (){ if(width >=0) System.out.println(width *width); } } public class Circle extends Shape { public Circle (int y){ width =y; } void area (){ if (width >=0) System.out.println (width* width* Math.PI); } } public class Program { public static void main(String[ ] args) { Scanner sc = new Scanner(; int x = sc.nextInt(); int y = sc.nextInt(); Square a = new Square(x); Circle b = new Circle(y); a.area(); b.area(); } }

8/8/2022 6:14:38 PM

С Сафронов

5 Answers

New Answer


You can link your code like this: Go to Code section, click +, select the programming language, insert your code, save. Come back to this thread, click +, Insert Code, sort for My Code Bits, select your code. This way it is more readable and people can test your code. Please tag the relevant programming language. If it is a sololearn task, please mention course name and task number.


С Сафронов You have to place who want help you in better conditions for help you.... Have you problem with a code? Dont copy it in post, but create it in "Code Playground" and insert it in the post (like Lisa explained) so it can be runned and tested directly. Futhermore you have to be more clear about your problem... Its frustrating for who help try to understand what is your problem (beside copy your code and try it on Playground) when you can explain what is your problem and, like said previously, attach the code on Playground ready to be tested


What do you not like about this code? 🤔


Project 55 Java, not complete secrets test 3


The task say nothing about negative values. Could this be a problem? Try to remove the conventions.