Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* steuern.c
- *
- * Copyright (C) 2008 Mihael Pranjic <tux@openxinu.linuxlovers.at>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; version 2 only.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
- #include <stdio.h>
- #include <stdbool.h>
- #define FALSE 0
- #define TRUE 1
- float calculate(float lohn, int isyoualleinverdiener)
- {
- float erstens,zweitens,drittens,absetzbetraege;
- int werbepauschale, sonderpauschale;
- werbepauschale = 132;
- sonderpauschale = 60;
- lohn = lohn * 12; /* How much do we earn a year? */
- lohn = lohn - (werbepauschale + sonderpauschale);
- /* The following part is dependent on how much you earn */
- if(((lohn - 10000) * 0.3833 )> 0)
- erstens = (lohn - 10000)* 0.3833;
- else
- erstens = 0;
- if(((lohn - 25000) * 0.436 )> 0)
- zweitens = (lohn - 25000)* 0.436;
- else
- zweitens = 0;
- if(((lohn - 51000) * 0.5 )> 0)
- drittens = (lohn - 51000)* 0.5;
- else
- drittens = 0;
- /* ........................................................... */
- absetzbetraege = absetzen(isyoualleinverdiener);
- lohn = lohn - ((erstens + zweitens + drittens) - absetzbetraege);
- return lohn;
- }
- int absetzen(int isyoualleinverdiener)
- {
- float absetzbetraege;
- absetzbetraege = 54 + 291;
- if(isyoualleinverdiener)
- absetzbetraege += 364;
- return absetzbetraege;
- }
- int main(void)
- {
- float lohn,ausgabe;
- char buf[11];
- char alleinverdiener[] = " ";
- int isyoualleinverdiener;
- /* get our needed information :) */
- printf("Bitte geben sie hier ihren *monatlichen* Lohn ein: ");
- fgets(buf, 11, stdin);
- sscanf(buf, "%f", &lohn);
- printf("Sind sie Alleinverdiener bzw. Alleinerzieher? [Ja/Nein]: ");
- fgets(buf, 5, stdin);
- sscanf(buf, "%s", &alleinverdiener);
- printf("%s", alleinverdiener);
- if(alleinverdiener[0]= *"Ja")
- isyoualleinverdiener = TRUE;
- if(alleinverdiener[0]= *"Nein")
- isyoualleinverdiener = FALSE;
- printf("%i", isyoualleinverdiener);
- ausgabe = calculate(lohn, isyoualleinverdiener);
- printf("Lohn: %f \n", ausgabe);
- return 0;
- }
Add Comment
Please, Sign In to add comment