User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 391,609 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,625 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser:
Views: 162 | Replies: 3 | Solved
Reply
Join Date: Jul 2008
Posts: 3
Reputation: twburkle is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
twburkle twburkle is offline Offline
Newbie Poster

Program Direction Advice Please

  #1  
Jul 7th, 2008
My program currently takes three inputs from the user ( Wage, Hours, Tips ), then it calculates the gross income. Im brushing up on my c++ and Im not sure what functions I need to look for, but I know what I want to do.

1. I would like to take multiple wage/tip/hour inputs and calculate one big gross income from previous gross income inputs.
Q: Would multiple arrays let me do that?
Last edited by twburkle : Jul 7th, 2008 at 10:35 pm. Reason: Clarification
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jul 2008
Posts: 3
Reputation: twburkle is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
twburkle twburkle is offline Offline
Newbie Poster

Re: Program Direction Advice Please

  #2  
Jul 7th, 2008
Here is some of my code at the moment. After narrowing some google searches, Array's look like should be able to accomplish what I need.

1. Can I assign an Array's element to one gross income, then use a loop to assign the next one? If so, is it as simple as array[1]=salary.calculateIncome or something around there?


        
cout << "Enter Name:";
        getline (cin,  name );

        cout << "Enter Wage ( per hour ):";
        cin >> wage;

        cout << "Enter Hours Worked:";
        cin >> time;

        cout << "Enter Tips:";
        cin >> tips;

        broSalary.setName( name );
        broSalary.setWage( wage );
        broSalary.setTime( time );
        broSalary.setTips( tips );

        cout << "Income:" << broSalary.calculateIncome() << endl;
 
Reply With Quote  
Join Date: Jan 2008
Posts: 1,403
Reputation: VernonDozier is a jewel in the rough VernonDozier is a jewel in the rough VernonDozier is a jewel in the rough VernonDozier is a jewel in the rough 
Rep Power: 6
Solved Threads: 179
VernonDozier VernonDozier is offline Offline
Nearly a Posting Virtuoso

Re: Program Direction Advice Please

  #3  
Jul 8th, 2008
Originally Posted by twburkle View Post
Here is some of my code at the moment. After narrowing some google searches, Array's look like should be able to accomplish what I need.

1. Can I assign an Array's element to one gross income, then use a loop to assign the next one? If so, is it as simple as array[1]=salary.calculateIncome or something around there?


        
cout << "Enter Name:";
        getline (cin,  name );

        cout << "Enter Wage ( per hour ):";
        cin >> wage;

        cout << "Enter Hours Worked:";
        cin >> time;

        cout << "Enter Tips:";
        cin >> tips;

        broSalary.setName( name );
        broSalary.setWage( wage );
        broSalary.setTime( time );
        broSalary.setTips( tips );

        cout << "Income:" << broSalary.calculateIncome() << endl;
 



There are lots of ways to do what you are trying to do. Arrays are one. Vectors are another. It's hard to comment with this little code. Clearly you are writing a class somewhere and broSalary's type is that class. You haven't posted the code where broSalary is declared and you haven't posted the class, so I can't really comment further. Please post the whole program including any class implementation and header code.
Reply With Quote  
Join Date: Jul 2008
Posts: 3
Reputation: twburkle is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
twburkle twburkle is offline Offline
Newbie Poster

Re: Program Direction Advice Please

  #4  
Jul 8th, 2008
ah ok, well if I can do it with arrays thats awesome, Ive messed around with those before, not vectors though =/, you kinda hit my answer right on the dot thanks
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb C++ Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the C++ Forum

All times are GMT -4. The time now is 12:10 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC