Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.Console;
- import java.util.Scanner;
- public class main {
- public static void main(String[] args) {
- int _anzahl;
- int _preis;
- double _result = 0.0;
- Scanner _in = new Scanner(System.in);
- System.out.print("Anzahl: ");
- _anzahl = _in.nextInt();
- System.out.print("Preis: ");
- _preis = _in.nextInt();
- if(_anzahl==5)
- {
- _result = _preis*0.98;
- }
- else if(_anzahl==10)
- {
- _result = _preis*0.95;
- }
- else if(_anzahl==20)
- {
- _result = _preis*0.90;
- }
- else
- {
- _result = _preis;
- }
- System.out.println();
- System.out.println("Stückpreis: " + _result);
- System.out.println("Gesammtpreis: " + _result*_anzahl);
- System.out.println();
- main(args);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement