Login
кто хочет голову поломать?
1116 просмотров
Перейти к просмотру всей ветки
in Antwort andrey.... 07.11.10 21:27
только по какой формуле surface рассчитывать,не знаю
В ответ на:
import java.io.BufferedReader;
import java.io.InputStreamReader;
/**
* Program to calculate surface
*
* @author
*/
public class Pyramide
{
/**
* Main method.
*
* @param args
* command line arguments
*/
public static void main(String args[])
{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
try
{
System.out.print("Please enter the hight in double precision: ");
String s = in.readLine();
double length = Double.parseDouble(s);
System.out.print("");
System.out.print("Please enter the length in double precision: ");
String ss = in.readLine();
double hight = Double.parseDouble(ss);
double surface = length*length * Math.sqrt(4*((hight+length)*length ));
System.out.println("The surface is "+surface);
}
catch (Exception e)
{
System.out.println("Invalid entry.");
System.exit(1); // non-zero status indicates abnormal termination
}
}
}
import java.io.BufferedReader;
import java.io.InputStreamReader;
/**
* Program to calculate surface
*
* @author
*/
public class Pyramide
{
/**
* Main method.
*
* @param args
* command line arguments
*/
public static void main(String args[])
{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
try
{
System.out.print("Please enter the hight in double precision: ");
String s = in.readLine();
double length = Double.parseDouble(s);
System.out.print("");
System.out.print("Please enter the length in double precision: ");
String ss = in.readLine();
double hight = Double.parseDouble(ss);
double surface = length*length * Math.sqrt(4*((hight+length)*length ));
System.out.println("The surface is "+surface);
}
catch (Exception e)
{
System.out.println("Invalid entry.");
System.exit(1); // non-zero status indicates abnormal termination
}
}
}
