проблем с домашно 07. 2D Rectangle Area
Скъпи колеги,
имам проблем с 07. 2D Rectangle Area. Judge системата ми дава 60/100.
Ето го и кода ми:
import com.sun.org.apache.xpath.internal.SourceTree;
import java.text.DecimalFormat;
import java.util.Scanner;
public class RectangleArea {
public static void main(String[] args) {
Scanner scanner = new Scanner (System.in);
double x1 = Double.parseDouble(scanner.nextLine());
double y1 = Double.parseDouble(scanner.nextLine());
double x2 = Double.parseDouble(scanner.nextLine());
double y2 = Double.parseDouble(scanner.nextLine());
double x = Math.max (x1,x2) - Math.min(x1,x2);
double y = Math.max (y1,y2) - Math.min (y1,y2);
double area = x*y;
double perimeter = 2*(x+y);
DecimalFormat df = new DecimalFormat( "###.#");
System.out.println (df.format (area));
System.out.println (df.format (perimeter));
}
}
Къде бъркам? Предварително благодаря!
Много ти благодаря, сработи! :) жив и здрав!