Hello, I encountered the "cannot find symbol" problem:
class Quadrate { double a; Quadrate (double a){ this.a = a; } double perimeter() { double value = 4 * a; return value; } double square() { double value = a * a; return value; } double diagonal() { double value = Math.sqrt(a * a + a * a); return value; } } public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n; System.out.print("Введите кол-во квадратов: "); while (true) { if (!sc.hasNextInt()) { System.out.print("Некорректний тип введеного числа! Повторите попитку: "); sc.next(); } else { n = sc.nextInt(); break; } } Quadrate[] quadrates = new Quadrate[n]; for(int i = 0; i < quadrates.length; i++) { System.out.printf("Введите сторону %d - го: ", i + 1); double v = sc.nextDouble(); quadrates[i] = new Quadrate(v); } for(int i = 0; i < quadrates.length; i++) { System.out.printf("Периметр %d - го: %f", i + 1, qudrates[i].perimeter()); // ошибка System.out.printf("Площадь %d - го: %f", i + 1, qudrates[i].square()); // ошибка System.out.printf("Диагональ %d - го: %f", i + 1, qudrates[i].diagonal()); // ошибка } } } You can also enter only human side values, and if double - an error, if not difficult, help, please.
import java.util.Scanner;- there is? Or specify completely. - Sergey Mitrofanov