Guest User

Untitled

a guest
Mar 13th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.62 KB | None | 0 0
  1. /* steuern.c
  2. *
  3. * Copyright (C) 2008 Mihael Pranjic <tux@openxinu.linuxlovers.at>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published
  7. * by the Free Software Foundation; version 2 only.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with this program; if not, write to the
  16. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  17. * Boston, MA 02111-1307, USA.
  18. */
  19.  
  20. #include <stdio.h>
  21. #include <stdbool.h>
  22.  
  23. #define FALSE 0
  24. #define TRUE 1
  25.  
  26.  
  27. float calculate(float lohn, int isyoualleinverdiener)
  28. {
  29. float erstens,zweitens,drittens,absetzbetraege;
  30. int werbepauschale, sonderpauschale;
  31. werbepauschale = 132;
  32. sonderpauschale = 60;
  33. lohn = lohn * 12; /* How much do we earn a year? */
  34.  
  35. lohn = lohn - (werbepauschale + sonderpauschale);
  36.  
  37. /* The following part is dependent on how much you earn */
  38. if(((lohn - 10000) * 0.3833 )> 0)
  39. erstens = (lohn - 10000)* 0.3833;
  40. else
  41. erstens = 0;
  42.  
  43.  
  44. if(((lohn - 25000) * 0.436 )> 0)
  45. zweitens = (lohn - 25000)* 0.436;
  46. else
  47. zweitens = 0;
  48.  
  49.  
  50. if(((lohn - 51000) * 0.5 )> 0)
  51. drittens = (lohn - 51000)* 0.5;
  52. else
  53. drittens = 0;
  54. /* ........................................................... */
  55. absetzbetraege = absetzen(isyoualleinverdiener);
  56. lohn = lohn - ((erstens + zweitens + drittens) - absetzbetraege);
  57. return lohn;
  58. }
  59.  
  60. int absetzen(int isyoualleinverdiener)
  61. {
  62. float absetzbetraege;
  63. absetzbetraege = 54 + 291;
  64. if(isyoualleinverdiener)
  65. absetzbetraege += 364;
  66.  
  67. return absetzbetraege;
  68. }
  69.  
  70. int main(void)
  71. {
  72. float lohn,ausgabe;
  73. char buf[11];
  74. char alleinverdiener[] = " ";
  75. int isyoualleinverdiener;
  76. /* get our needed information :) */
  77. printf("Bitte geben sie hier ihren *monatlichen* Lohn ein: ");
  78. fgets(buf, 11, stdin);
  79. sscanf(buf, "%f", &lohn);
  80.  
  81. printf("Sind sie Alleinverdiener bzw. Alleinerzieher? [Ja/Nein]: ");
  82. fgets(buf, 5, stdin);
  83. sscanf(buf, "%s", &alleinverdiener);
  84. printf("%s", alleinverdiener);
  85.  
  86. if(alleinverdiener[0]= *"Ja")
  87. isyoualleinverdiener = TRUE;
  88.  
  89. if(alleinverdiener[0]= *"Nein")
  90. isyoualleinverdiener = FALSE;
  91. printf("%i", isyoualleinverdiener);
  92.  
  93.  
  94. ausgabe = calculate(lohn, isyoualleinverdiener);
  95.  
  96. printf("Lohn: %f \n", ausgabe);
  97. return 0;
  98. }
Add Comment
Please, Sign In to add comment