home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / jËzyki_programowania / pascal / wwg-crt / nettolohn.p < prev    next >
Text File  |  1997-07-14  |  3KB  |  109 lines

  1. program netto;
  2.  
  3. {$I "include:utils/crt.i"}
  4.  
  5. const
  6.    kv =  0.12;    { Krankenversicherungssatz }
  7.    av =  0.065;   { Arbeitslosenversicherungssatz }
  8.    pv =  0.017;   { Pflegeversicherungssatz }
  9.    rv =  0.202;   { Rentenversicherungssatz }
  10.    
  11.    ls =  0.2;     { Fiktiver Lohnsteuersatz }
  12.    sz =  0.075;   { Solidaritätszuschlagssatz }
  13.    
  14.    t1 =  3;    { Tabulator 1 }
  15.    t2 =  30;   { Tabulator 2 }
  16.    
  17. var
  18.    kirche_ja   :  boolean;
  19.    stunden     :  integer;
  20.    stundenlohn, lohnsteuer, brutto, sozi, ks : real;
  21.    key         :  char;
  22.    
  23. function WritePrompt(spalte : integer; str : string) : integer;
  24. begin
  25.    GotoXY(t1, spalte);  Write(str);
  26.    GotoX(t2-3);         Write(" > ");
  27.    
  28.    WritePrompt := WhereX;
  29. end;
  30.    
  31. procedure WriteLnBetrag(str : string; betrag : real; prozent : real);
  32. begin
  33.    GotoX(t1);     Write(str);
  34.    GotoX(t2-3);   Write(" : ");
  35.    
  36.    if prozent >= 0 then WriteLn((betrag*prozent):10:2, " DM [", (prozent*100):2:2, "%]")
  37.    else WriteLn(betrag:10:2, " DM");
  38. end;
  39.  
  40. function JaNein(spalte : integer; str : string) : boolean;
  41. var
  42.    antwort  :  char;
  43.    zeile    :  integer;
  44. begin
  45.    zeile    := WhereY;
  46.    spalte   := WritePrompt(spalte, str);
  47.    
  48.    Write("j oder n");
  49.    GotoX(spalte);
  50.    
  51.    repeat
  52.       antwort := ReadKey;
  53.    until (antwort = char($0D)) or (antwort = 'j') or (antwort = 'n');
  54.    
  55.    if antwort = char($0D) then antwort := 'j';
  56.    
  57.    GotoX(spalte); WriteLn(antwort, "       ");
  58.    
  59.    JaNein := (antwort = 'j');
  60. end;
  61.  
  62. begin
  63.    ClrScr;
  64.    ConBackground(1);
  65.    
  66.    repeat
  67.       TextColor(0);
  68.       GotoXY(t1+2, 2);  Write("Berechnung des monatlichen Nettolohnes");
  69.       GotoXY(t1+2, 3);  Write("¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯");
  70.       TextColor(4);
  71.       CursorOn;
  72.       GotoX(WritePrompt(4, "  Anzahl Arbeitsstunden"));  ReadLn(stunden);
  73.       GotoX(WritePrompt(5, "  Stundenlohn"));            ReadLn(stundenlohn);
  74.  
  75.       TextColor(2);
  76.       kirche_ja   := JaNein(6, "  Kirchenmitglied");
  77.       brutto      := stundenlohn * stunden;
  78.  
  79.       TextColor(4);
  80.       WriteLnBetrag("  Bruttolohn", brutto, -1);
  81.  
  82.       lohnsteuer  := brutto * ls;
  83.  
  84.       TextColor(3);
  85.       WriteLnBetrag("- Lohnsteuer", brutto, ls);
  86.       WriteLnBetrag("- Solizuschlag", lohnsteuer, sz);
  87.  
  88.       if (kirche_ja = true) then begin
  89.          ks := 0.09;
  90.          WriteLnBetrag("- Kirchensteuer", lohnsteuer, ks);
  91.       end else ks := 0;
  92.  
  93.       WriteLnBetrag("- Rentenversicherung", brutto, rv/2);
  94.       WriteLnBetrag("- Krankenversicherung", brutto, kv/2);
  95.       WriteLnBetrag("- Arbeitslosenvers.", brutto, av/2);
  96.       WriteLnBetrag("- Pflegeversicherung", brutto, pv/2);
  97.       
  98.       TextColor(4);
  99.       WriteLnBetrag("= Nettolohn", (brutto - lohnsteuer*(1+sz+ks) - brutto*((rv+kv+av+pv)/2)), -1);
  100.       
  101.       CursorOff;
  102.       
  103.       key := ReadKey;
  104.       
  105.       ClrScr;
  106.    until key = 'q';
  107.    
  108.    ConReset;
  109. end.