Вход на сайт
кто хочет голову поломать?
1116 просмотров
Перейти к просмотру всей ветки
у меня никак не выходит привести её в рабочее состояние
Gegeben sei das untenstehende Java-Programm. Finden Sie die
Fehler und Verbessern Sie sie!
Hinweise:
Das Programm Ein korrekter Durchlauf sieht wie folgt aus:
Please enter the hight in double precision: 2.0
Please enter the length in double precision: 3.0
The surface is 15.0
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 mymain(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 s = in.readLine();
int hight = Double.parseDouble(s);
double surface = length*length * Math.sqrt(4(hight+length)*length );
System.out.println("The surface is "+hight);
}
catch (Exception e)
{
System.out.println("Invalid entry.");
System.exit(1); // non-zero status indicates abnormal termination
}
}
}[/url]


Gegeben sei das untenstehende Java-Programm. Finden Sie die
Fehler und Verbessern Sie sie!
Hinweise:
Das Programm Ein korrekter Durchlauf sieht wie folgt aus:
Please enter the hight in double precision: 2.0
Please enter the length in double precision: 3.0
The surface is 15.0
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 mymain(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 s = in.readLine();
int hight = Double.parseDouble(s);
double surface = length*length * Math.sqrt(4(hight+length)*length );
System.out.println("The surface is "+hight);
}
catch (Exception e)
{
System.out.println("Invalid entry.");
System.exit(1); // non-zero status indicates abnormal termination
}
}
}[/url]