Also ich habe folgendes Programm gecodet...
Hab das Programm so abgeschrieben und es hat auch so inner Schule geklappt jedoch gibt der mir 9 Fehler aus... nur kp warum...
Ich programmiere mitm JOE und der SDK "JDK 1.3.0_01"
Code:
// Java Applications
// 10.01.2006
import java.swing.*;
public class addition
{
public static void main(String args[])
{
String erstezahl,zweitezahl,auswahl,weiter;
float Zahl1,Zahl2,Summe=0;
auswahl =JOptionPane.showInputDialog("Welche Rechenoperation wollen Sie durchführen?\n(+ - / *)");
erstezahl=JOptionPane.showInputDialog("Geben Sie die erste Zahl ein!\nAusgewählte Operation: "+auswahl);
zweitezahl=JOptionPane.showInputDialog("Geben Sie die zweite Zahl ein!\nAusgewählte Operation: "+auswahl);
Zahl1=Float.parseFloat(erstezahl);
Zahl2=Float.parseFloat(zweitezahl);
if(auswahl.equals("+")){
Summe=Zahl1+Zahl2;}
if(auswahl.equals("-")){
Summe=Zahl1-Zahl2;}
if(auswahl.equals("*")){
Summe=zahl1/Zahl2;}
if(auswahl.equals("/")){
if(Zahl2==0){
do{
JOptionPane.showMessageDialog(null,"Division durch 0 ist nicht zulässig!");
zweitezahl=JOptionPane.showInputDialog("Geben Sie erneut die zweite Zahl ein!\nAusgewählte Operation: "+auswahl);
Zahl2=Float.parseFloat(zweitezahl);}
while(Zahl2==0);
if(Zahl2!=0)
Summe=Zahl1/Zahl2;}}
else{
Summe=Zahl1/Zahl2;}
JOptionPane.showMessageDialog(null,"Die Summe ist: "+summe);
System.exit(0);
}
}
Hab das Programm so abgeschrieben und es hat auch so inner Schule geklappt jedoch gibt der mir 9 Fehler aus... nur kp warum...
Ich programmiere mitm JOE und der SDK "JDK 1.3.0_01"