Lösungsvorschlag Aufgabe 2.1.7.: Unterschied zwischen den Versionen
Aus ComeniusWiki
(Die Seite wurde neu angelegt: „import java.util.Scanner; public class Aufgaben_2_1{ Scanner eingabe = new Scanner (System.in); public void Prozentumrechnung(){ System.out.print("Geben Sie …“) |
|||
| Zeile 6: | Zeile 6: | ||
| − | public void Prozentumrechnung(){ | + | public void Prozentumrechnung(){ |
| − | System.out.print("Geben Sie ihren gesamten Betrag ein: ");; | + | System.out.print("Geben Sie ihren gesamten Betrag ein: ");; |
| − | double gesamt = eingabe.nextInt(); | + | double gesamt = eingabe.nextInt(); |
| − | System.out.print("Geben Sie den Anteil des gesamt Betrages ein: "); | + | System.out.print("Geben Sie den Anteil des gesamt Betrages ein: "); |
| − | double anteil= eingabe.nextInt(); | + | double anteil= eingabe.nextInt(); |
| − | double prozent = (anteil/gesamt)*100 ; | + | double prozent = (anteil/gesamt)*100 ; |
| − | System.out.println(""+anteil+" sind "+prozent+"% von "+gesamt+""); | + | System.out.println(""+anteil+" sind "+prozent+"% von "+gesamt+""); |
} | } | ||
} | } | ||
Version vom 13. Oktober 2013, 19:33 Uhr
import java.util.Scanner;
public class Aufgaben_2_1{
Scanner eingabe = new Scanner (System.in);
public void Prozentumrechnung(){
System.out.print("Geben Sie ihren gesamten Betrag ein: ");;
double gesamt = eingabe.nextInt();
System.out.print("Geben Sie den Anteil des gesamt Betrages ein: ");
double anteil= eingabe.nextInt();
double prozent = (anteil/gesamt)*100 ;
System.out.println(""+anteil+" sind "+prozent+"% von "+gesamt+"");
} }

