Proyecto Java módulo 5 formas | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Proyecto Java módulo 5 formas

Tengo una duda respecto al proyecto final, no sé cuál es mi error y quería ver si alguien me puede ayudar. Gracias. public class Square extends shape{ Square (int width){ this.width = width; } } Enum area(){ System.out.println(width * width); } } public class Circle extends Shape { Circle(int width ){ this.width = width; } Enum area(){ double pi = Math.PI; System.out.println(pi * width * width); } } 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(x); Circle b = new Circle(y); a.area(); b.area(); } }

11th May 2021, 12:39 AM
Sandra Pichardo Regalado
Sandra Pichardo Regalado - avatar
2 Answers
0
¿Dónde está la definición de clase shape ()? también es forma () o forma ()? distingue mayúsculas y minúsculas..! ¿Por qué el tipo de retorno del método area () es Enum? se puede utilizar allí como vacío. área vacía () { .. } where is shape() class defination? also is it shape() or Shape() ? case sensitive..! why area() method return type is Enum? you can use there as void. void area(){ .. }
11th May 2021, 6:16 PM
Jayakrishna 🇮🇳
0
Alguien ha conseguido un código que le pase todas las pruebas??. Mi código pasa todos los test, menos el 3º
18th Aug 2021, 11:43 PM
Daniel
Daniel - avatar