C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old August 10th, 2004, 07:49 PM
Majestica Majestica is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 2 Majestica User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Help with array...

OK I need some help. I am a bit of a beginner with C++. I have a small
project due and I am having a hard time even knowing where to start. I have
attempted a flow chart and pseudocode, and to no help I am still at ground zero.
I am not looking for someone to do it for me, just maybe point me in some type of
general direction. I will give to you the wording as it was to me:

Use a single subscripted array to solve the following problem. A company pays its sales
people on a commission basis. The sales people receive $200.00 per week plus 9 percent
of their gross sales for that week. For example, a sales person who grosses $5000 in
sales in a week receives $200 plus 9% of $5000, or a total of $650. Write a program using
an array of counters that determines how many of the sales people earned salaries in each of the
following ranges ( assume that each salesperson's salary is truncated to an integer amt ):

a) $200-$299
b) $300-$399
c) $400-$499
d) $500-$599
e) $600-$699
f) $700-$799
g) $800-$899
h) $900-$999
i) $1000 and over

1. The progam should process as many salespersons data that the user wants to enter. A solution might include
asking the user if there is salespersons to be processed or not
2. Use the array indexes ( subscripts ) to 'map' to the computed salary ranges. The data stored in the array
can represent the 'number of sales persons' in each of the computed salary ranges.

OK I am new to C++ I can do really basic things, and I mean basic so this I am having a hard time with this.
I have read and read and read the material that I was given and attempted to comprehend, but I really
don't even know where to start. Once again, I am not looking for someone to do it completely, maybe just help
me get started or get an idea. Any help/hints/tips greatly appreciated!!

Thanks

Reply With Quote
  #2  
Old August 11th, 2004, 03:57 AM
kode_monkey kode_monkey is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 367 kode_monkey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 21 sec
Reputation Power: 12
My first piece of advice would be to give it a go. Theres a million and one tutorials out there that will tell you how to set up a small c++ program that prints 'hello world' on the screen. Then from there read another that tells you about user input and play around with it. Keep reading tutorials and trying things out then when you have specific questions let us know we're always happy to help on things like that but don't really see what we can give you if you've made some pseudo code and a flow chart already.

-KM-

Reply With Quote
  #3  
Old August 11th, 2004, 07:55 PM
Majestica Majestica is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 2 Majestica User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thanks I have actually gotten it completed I think!!


!!!!!!!!!!!

Reply With Quote
  #4  
Old May 2nd, 2005, 04:05 PM
psoftdba psoftdba is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2005
Posts: 1 psoftdba User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 41 sec
Reputation Power: 0
Thumbs up My Program is bumming.

Quote:
Originally Posted by Majestica
thanks I have actually gotten it completed I think!!


!!!!!!!!!!!
- Can I get a copy of the program?
thanks,

Reply With Quote
  #5  
Old May 28th, 2005, 04:49 PM
ComscienceWhiz ComscienceWhiz is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2005
Posts: 1 ComscienceWhiz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 54 sec
Reputation Power: 0
Did you get it working finally or are you still having problems? E-mail me what you have so I can take a look at it.

Thanks,
-CW

Reply With Quote
  #6  
Old January 21st, 2013, 09:14 PM
Seramet005 Seramet005 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 2 Seramet005 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 41 m 23 sec
Reputation Power: 0
Salesman Sales and salary

A company pays its salespeople on a commission basis. The salespeople each receive $200 per week plus 9 percent of their gross sales for the sales period. For example, a salesperson who grosses $5000 in sales in the period receives $200 plus 9 percent of $5000, or a total of $650. Write a program determines for each salesperson their total sales and their salary. There are 5 salesmen for the company. The data file is "SalesPerson Sales.txt". It contains the salesperson number (1-5) followed by his sales. Each salesperson has numerous sales listed in the file.

List out each sales person's number, their total sales and their salary. Restriction: No arrays, use a switch statement, and use functions.

The problem is that I can't get the total sales (aka gross) to compute right. Here's my source code from c++:
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;

void number1();
void number2();
void number3();
void number4();
void number5();
ofstream outputFile;
ifstream inputFile;
double number = 0;
int salesman;
double gross1 = 0;
double gross2 = 0;
double gross3 = 0;
double gross4 = 0;
double gross5 = 0;

int main()
{


outputFile.open ("Salesman Salary.txt");
outputFile << " Salesman Sales and Salary\n\n";
cout << " Salesman Sales and Salary\n\n";
inputFile.open("Salesman Gross.txt");

cout << "Enter either 1, 5, or number in b/tw to view the salary table. ";
cin >> salesman;
cout << " SALESMAN\t" << "\tGROSS SALES" << "\tTOTAL SALARY\n";
outputFile << " SALESMAN\t" << "\tGROSS SALES" << "\tTOTAL SALARY\n";
switch (salesman)
{

case 1: inputFile >> number;
number++;
gross1 += number;
number1();
case 2: inputFile >> number;
number++;
gross2 += number;
number2();
case 3: inputFile >> number;
number++;
gross3 += number;
number3();
case 4: inputFile >> number;
number++;
gross4 += number;
number4();
case 5: inputFile >> number;
number++;
gross5 += number;
number5();
break;
default: cout << "Invalid Entry. Please restart and enter either 1, 5, or a number in between.";
}
outputFile.close();
inputFile.close();
return 0;
}
// Calculate Sales of Salesman 1.
void number1()
{
double Total1;
salesman = 1;

Total1 = 200 + (.09 * gross1);

cout << fixed << showpoint << setprecision(2);
cout << "\t1\t" << "\t $" << gross1 << "\t\t$" << Total1 << "\t\n";
outputFile << "\t1\t" << "\t $" << gross1 << "\t\t$" << Total1 << "\t\n";

}
// Calculate Sales of Salesman 2.
void number2()
{
double Total2;
salesman = 2;

Total2 = 200 + (.09 * gross2);

cout << fixed << showpoint << setprecision(2);
cout << "\t2\t" << "\t $" << gross2 << "\t\t$" << Total2 << "\t\n";
outputFile << "\t2\t" << "\t $" << gross2 << "\t\t$" << Total2 << "\t\n";
}
// Calculate Sales of Salesman 3.
void number3()
{
double Total3;
salesman = 3;

Total3 = 200 + (.09 * gross3);

cout << fixed << showpoint << setprecision(2);
cout << "\t3\t" << "\t $" << gross3 << "\t\t$" << Total3 << "\t\n";
outputFile << "\t3\t" << "\t $" << gross3 << "\t\t$" << Total3 << "\t\n";
}
// Calculate Sales of Salesman 4.
void number4()
{
double Total4;
salesman = 4;

Total4 = 200 + (.09 * gross4);

cout << fixed << showpoint << setprecision(2);
cout << "\t4\t" << "\t $" << gross4 << "\t\t$" << Total4 << "\t\n";
outputFile << "\t4\t" << "\t $" << gross4 << "\t\t$" << Total4 << "\t\n";
}
// Calculate Sales of Salesman 1.
void number5()
{
double Total5;
salesman = 5;

Total5 = 200 + (.09 * gross5);

cout << fixed << showpoint << setprecision(2);
cout << "\t5\t" << "\t $" << gross5 << "\t\t$" << Total5 << "\t\n";
outputFile << "\t5\t" << "\t $" << gross5 << "\t\t$" << Total5 << "\t\n";
}
This is my results:
Salesman Sales and Salary

SALESMAN GROSS SALES TOTAL SALARY
1 $3 $200.27
2 $11.8 $201.062
3 $4 $200.36
4 $151 $213.59
5 $2 $200.18
Can someone help me with the gross calculations?

Reply With Quote
  #7  
Old January 22nd, 2013, 08:39 PM
McGl0othin McGl0othin is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 4 McGl0othin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 45 sec
Reputation Power: 0
I will give to you the wording as it was to me:
URLURLURL

Reply With Quote
  #8  
Old January 23rd, 2013, 08:33 AM
lookseekke lookseekke is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 1 lookseekke User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 44 sec
Reputation Power: 0
good job,The salespeople each receive $200 per week plus 9 percent of their gross sales for the sales period. thanks

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > Help with array...


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

© 2003-2014 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap