Hallo leute,
ich bin ganz neu in Java und brauche für meine Hausaufgabe hilfe
erstmal die Aufgabe :
•erstelle eine For-Schleife (RefundFor) Programm für die Leergut-Rückgabe
---------------
mit der for schleife komme ich leider nicht klar.... wahrscheinlich ist auch die if anweisung
innerhalb der for schleife bei mir falsch ..... könnt ihr mir da bitte weiter helfen ???
ich hab es schonmal soweit programmiert --->
Hier mein Java Programm :
Danke schonmal !
ich bin ganz neu in Java und brauche für meine Hausaufgabe hilfe
erstmal die Aufgabe :
•erstelle eine For-Schleife (RefundFor) Programm für die Leergut-Rückgabe
---------------
mit der for schleife komme ich leider nicht klar.... wahrscheinlich ist auch die if anweisung
innerhalb der for schleife bei mir falsch ..... könnt ihr mir da bitte weiter helfen ???
ich hab es schonmal soweit programmiert --->
Hier mein Java Programm :
Java:
public class RefundFor {
public static void main(String[] args) {
int flasche = 20 ;
int leereKiste = 500 ; // Pfand umgerechnet in Cent, 5€=500Cent
int volleKiste = 500+(9*flasche) ; // 500Cent + Pfand von 9 Flaschen
{
Out.println("Leergutannahme:");
Out.println(" 1 leere Kiste (5 Euro)") ;
Out.println(" 2 volle Kiste (5 Euro zzgl. 9 mal Flaschenpfand)") ;
Out.println(" 3 Flasche (20 Cent)") ;
Out.println(" 0 Eingabe beenden") ;
}
Out.print("Naechste Eingabe:");
int pfand ;
int eingabe ;
pfand = 0 ;
for(
(if(eingabe==1) pfand = pfand+leereKiste ;
if(eingabe==2) pfand = pfand+volleKiste ;
if(eingabe==3) pfand = pfand+flasche ;)
( eingabe != 0 ) ;
(Out.print("Naechste Eingabe:");
eingabe = In.readInt();)
)
int preis = pfand/100 ;
int preis2 = pfand % 100 ; // Cent wird ausgerechnet
Out.print("Sie erhalten " +preis+ " Euro und "+preis2+ " Cent Pfand");
}
}
Danke schonmal !