Total members 11893 |It is currently Tue Nov 05, 2024 3:55 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





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:




Author:
Newbie
User avatar Posts: 2
Have thanks: 0 time

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]++;
}

   }




_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time

did it help you ?

_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time

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


Author:
Newbie
User avatar Posts: 2
Have thanks: 0 time

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;
}


_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time

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 ...


Author:
Moderator
User avatar Posts: 47
Have thanks: 1 time

ok :)

_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 7 posts ] 

  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     -  









Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com