Switch to full style
For C/C++ coders discussions and solutions
Post a reply

use one dimensional array to solve sales commissions

Sun Nov 09, 2008 5:22 pm

Hello Everyone I'm new to c/c++ programming and I need help with this asignment Please!! Help......(Sales Commissions) Use a one-dimensional array to solve the following problem: A company pays its salespeople on a commission basis. The salespeople receive $200 per week plus 9% of their gross sales for that week. For example, a salesperson who grosses $3000 in sales in a week receives $200 plus 9% of $3000, or a total of $470. Write an application (using an array of counters) that determines how many of the salespeople earned salaries in each of the following ranges (assume that each salesperson's salary is truncated to an integer amount):
1. $200-299
2. $300-399
3. $400-499
4. $500-599
5. $600-699
6. $700-799
7. $800-899
8. $ 900-999
9. $1000 and over :confused:



Re: Please Help!!... I'm new in programming in c/c++ and I need

Sun Nov 09, 2008 8:06 pm

i thought in the following for you
create array to count all size of 9 ( remember index is from 0-8 )

if the income is fro example 200$ , 200/100 equal 2 and (2-2) equal 0 and so on .
Code:
   int grosses=30000;
   int income=0;
   for(int i=0;i<sizeof(myarr);i++)
   {
       income=grosses*0.9+myarr[i];
        if(income>=1000)
         {
              counterarray[8]++;
          }
else
{
          counterarray[((int)income/100)-2]++;
}

   }




Re: Please Help!!... I'm new in programming in c/c++ and I need

Sat Dec 06, 2008 11:23 pm

did it help you ?

Re: Please Help!!... I'm new in programming in c/c++ and I need

Mon Dec 08, 2008 3:12 pm

Yes the code did help..Thank you..

I have another program I need help with if you don't mind.

I need to write that inputs a line of text with function gets into char array s[ 100 ]. output the line in uppercase letters and in lowercase letters..
Again I thank you..
Karen

Re: Please Help!!... I'm new in programming in c/c++ and I need

Mon Dec 08, 2008 3:42 pm

this is example use toupper function in C++ library
Code:
#include <iostream>
#include <ctype.h>

using std::cout;
using std::endl;

void touppercase(char *oldarray1, char *newarray2)
{
for(int i = 0; i <= strlen(oldarray1); i++)
{
newarray2[i] = toupper(oldarray1[i]);
}
}


int main()
{
char oldarray1[5] = {'a','b','c','d'};
char newarray2[5];
touppercase(oldarray1, newarray2);
cout << newarray2 << endl;
}


Re: Please Help!!... I'm new in programming in c/c++ and I need

Thu Dec 25, 2008 11:27 pm

hey mate stop solving their homework let them do some code themselves then we can help them out with it ....
if we give them the answer they ll never learn anything ...

Re: Please Help!!... I'm new in programming in c/c++ and I need

Fri Dec 26, 2008 12:41 am

ok :)

Post a reply
  Related Posts  to : use one dimensional array to solve sales commissions
 Use two dimensional array to build company sales program     -  
 Java Two Dimensional Array     -  
 Salary of each sales person     -  
 Salary of each sales person     -  
 Looking for sales agent for web development products     -  
 Javascript Multi-dimensional Arrays     -  
 clarification of high dimensional databases using query     -  
 I need you to help me to solve this program by c++ language     -  
 how to solve that isssue i m nt able to connect cam and code     -  
 solve the complex numbers and do operations on it     -