Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 131,603 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,001 people online right now. Registration is fast and FREE... Join Now!




need help on functions

 
Reply to this topicStart new topic

need help on functions, payroll/C++

Kcbroncofan
post 13 Dec, 2005 - 03:21 PM
Post #1


D.I.C Head

**
Joined: 28 Sep, 2005
Posts: 55


My Contributions


I need to calculate the state taxes which are 8% of the gross pay. I need to put this in a function. I am lost how to do this. I have it working but it is not in a function. I need to also do this for federal taxes.
User is offlineProfile CardPM

Go to the top of the page


Mrafcho001
post 13 Dec, 2005 - 03:40 PM
Post #2


D.I.C Addict

Group Icon
Joined: 1 Nov, 2005
Posts: 753



Thanked 5 times

Dream Kudos: 120
My Contributions


Well if the user inputs the gross pay, then its very simple.

You are most likely to want the function return type to be double, and to accept one argument (the gross pay).

and the function is gonna return:

gross pay * 0.08

maybe that helps out a bit? Make sure to declare/define the function above main.
User is offlineProfile CardPM

Go to the top of the page

eLliDKraM
post 13 Dec, 2005 - 05:05 PM
Post #3


Pepè Le Pewn

Group Icon
Joined: 13 Aug, 2005
Posts: 6,565



Thanked 2 times

Dream Kudos: 225
My Contributions


What kind of federal taxes?
User is offlineProfile CardPM

Go to the top of the page

Amorphous
post 13 Dec, 2005 - 08:26 PM
Post #4


New D.I.C Head

*
Joined: 10 Dec, 2005
Posts: 44



Thanked 1 times
My Contributions


Call a function in which the user input is an argument and evaluates through the function returning the wanted data.

CODE
float TaxReturn(float value1) {
value1+=value1*0.08;
return value1;
}


right?
User is offlineProfile CardPM

Go to the top of the page

Amadeus
post 14 Dec, 2005 - 06:07 AM
Post #5


g++ -o drink whiskey.cpp

Group Icon
Joined: 12 Jul, 2002
Posts: 12,158



Thanked 32 times

Dream Kudos: 25
My Contributions


Correct, but as an FYI, Amorphous, for academic assignments, we like to see that the user has made an effort before we provide an answer, as per the rules of the forum located here.
User is offlineProfile CardPM

Go to the top of the page

Kcbroncofan
post 14 Dec, 2005 - 03:43 PM
Post #6


D.I.C Head

**
Joined: 28 Sep, 2005
Posts: 55


My Contributions


Thank you for that information but I would really like to understand how to do them. Can anyone help me out.
User is offlineProfile CardPM

Go to the top of the page

SPlutard
post 14 Dec, 2005 - 03:55 PM
Post #7


code.ninja @ Java, C, Flash, Python

Group Icon
Joined: 13 Aug, 2005
Posts: 607



Dream Kudos: 545
My Contributions


Which part is confusing you? Functions in general, or how to get the above code, or something else?
User is offlineProfile CardPM

Go to the top of the page

Kcbroncofan
post 14 Dec, 2005 - 03:57 PM
Post #8


D.I.C Head

**
Joined: 28 Sep, 2005
Posts: 55


My Contributions


Fuctions in general.
User is offlineProfile CardPM

Go to the top of the page

SPlutard
post 14 Dec, 2005 - 04:03 PM
Post #9


code.ninja @ Java, C, Flash, Python

Group Icon
Joined: 13 Aug, 2005
Posts: 607



Dream Kudos: 545
My Contributions


Ok. Here's a nice little article I found through our resources section. Hopefully, it'll answer your questions and clarify a few things. If it doesn't help, just ask for help.

Linkage
User is offlineProfile CardPM

Go to the top of the page

Kcbroncofan
post 14 Dec, 2005 - 04:54 PM
Post #10


D.I.C Head

**
Joined: 28 Sep, 2005
Posts: 55


My Contributions


This is what I have not sure what I am doing wrong. I can get it all to work but the state taxes.


Attached File(s)
Attached File  Payroll.doc ( 32.5k ) Number of downloads: 59
User is offlineProfile CardPM

Go to the top of the page

eLliDKraM
post 14 Dec, 2005 - 05:40 PM
Post #11


Pepè Le Pewn

Group Icon
Joined: 13 Aug, 2005
Posts: 6,565



Thanked 2 times

Dream Kudos: 225
My Contributions


How about embedding your code on the forum because I do not download files...

This post has been edited by eLliDKraM: 14 Dec, 2005 - 05:41 PM
User is offlineProfile CardPM

Go to the top of the page

Kcbroncofan
post 14 Dec, 2005 - 05:47 PM
Post #12


D.I.C Head

**
Joined: 28 Sep, 2005
Posts: 55


My Contributions


I want to thank you for your help with this program. I got it all done. I would not have with out everyones help.
User is offlineProfile CardPM

Go to the top of the page

Reply to this topicStart new topic
Time is now: 11/20/08 04:10AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month