add PCHaendler_Methoden_EVA
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||||
|
<classpathentry kind="src" path="src"/>
|
||||||
|
<classpathentry kind="output" path="bin"/>
|
||||||
|
</classpath>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/bin/
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>PCHaendler</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
|
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||||
|
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||||
|
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||||
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.release=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
public class PCHaendler {
|
||||||
|
|
||||||
|
public static String liesString(String text) {
|
||||||
|
Scanner myScanner = new Scanner(System.in);
|
||||||
|
System.out.println(text);
|
||||||
|
return myScanner.next();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int liesInt(String text) {
|
||||||
|
Scanner myScanner = new Scanner(System.in);
|
||||||
|
System.out.println(text);
|
||||||
|
return myScanner.nextInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double liesDouble(String text) {
|
||||||
|
Scanner myScanner = new Scanner(System.in);
|
||||||
|
System.out.println(text);
|
||||||
|
return myScanner.nextDouble();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double berechneGesamtnettopreis(int anzahl, double nettopreis) {
|
||||||
|
return anzahl * nettopreis;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double berechneGesamtnettopreis(double nettogesamtpreis, double mwst) {
|
||||||
|
return nettogesamtpreis * (1 + mwst / 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void rechungausgeben(String artikel, int anzahl, double nettogesamtpreis, double bruttogesamtpreis, double mwst) {
|
||||||
|
System.out.println("\tRechnung");
|
||||||
|
System.out.printf("\t\t Netto: %-20s %6d %10.2f %n", artikel, anzahl, nettogesamtpreis);
|
||||||
|
System.out.printf("\t\t Brutto: %-20s %6d %10.2f (%.1f%s)%n", artikel, anzahl, bruttogesamtpreis, mwst, "%");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
// Benutzereingaben lesen
|
||||||
|
|
||||||
|
String artikel = liesString("Was möchten Sie bestellen?");
|
||||||
|
int anzahl = liesInt("Geben Sie die Anzahl ein:");
|
||||||
|
double preis = liesDouble("Geben Sie den Nettopreis ein:");
|
||||||
|
double mwst = liesDouble("Geben Sie den Mehrwertsteuersatz in Prozent ein:");
|
||||||
|
|
||||||
|
// Verarbeiten
|
||||||
|
double nettogesamtpreis = berechneGesamtnettopreis (anzahl, preis);
|
||||||
|
double bruttogesamtpreis = berechneGesamtnettopreis (nettogesamtpreis, mwst);
|
||||||
|
|
||||||
|
// Ausgeben
|
||||||
|
rechungausgeben(artikel, anzahl, nettogesamtpreis, bruttogesamtpreis, mwst);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user