Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.75 KB | None | 0 0
  1. import java.io.Console;
  2. import java.util.Scanner;
  3.  
  4. public class main {
  5.  
  6.     public static void main(String[] args) {
  7.         int _anzahl;
  8.         int _preis;
  9.         double _result = 0.0;
  10.         Scanner _in = new Scanner(System.in);
  11.        
  12.         System.out.print("Anzahl: ");
  13.         _anzahl = _in.nextInt();
  14.        
  15.         System.out.print("Preis: ");
  16.         _preis = _in.nextInt();
  17.        
  18.         if(_anzahl==5)
  19.         {
  20.             _result = _preis*0.98;
  21.         }
  22.         else if(_anzahl==10)
  23.         {
  24.             _result = _preis*0.95;
  25.         }
  26.         else if(_anzahl==20)
  27.         {
  28.             _result = _preis*0.90;
  29.         }
  30.         else
  31.         {
  32.             _result = _preis;
  33.         }
  34.        
  35.         System.out.println();
  36.        
  37.         System.out.println("Stückpreis: " + _result);
  38.         System.out.println("Gesammtpreis: " + _result*_anzahl);
  39.        
  40.         System.out.println();
  41.        
  42.         main(args);
  43.     }
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement