[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Array Problem
From: |
Keith |
Subject: |
Array Problem |
Date: |
Sun, 10 Jul 2005 23:57:32 -0400 |
Ok, what I am looking for this program to do is compute salary and then use
a single subscripted array to output the amount of employees that are in
each pay bracket. ie. 200-299, 300-399 and so forth to 1000. How can I
accomplish this? I seem to be running into a wall here. Can anyone help?
Thanks.
//This program computes the amount of employees who receive a salary in a
set number of ranges.
//Assignment 4.10
#include <iostream>
#include <iomanip>
#include <conio.h>
using std::cout;
using std::cin;
double pay[];
double calculateSalary (double totalEarned){
// regular earning of each employee
double basesalary(200);
// total amount employee brings to company
double earnings(totalEarned);
// percentage of amount employee receives as commision
double commision(earnings * .09);
// total amount employee earns with commision
double totalearned=(commision + basesalary);
return totalearned;
}
int main() //begins program execution
{
double earnings(0);
double totalEarned=0;
while (earnings =! -1)
cout << "Enter total sales for employee (Enter -1 to stop and tabulate) :";
cin >> earnings;
cout << "\nHere is the total salary of employee: $" <<
calculateSalary(earnings);
double pay[] = {200,300,400,500,600,700,800,900,1000};
{
for (i = 0, i < size, i++)
if calculateSalary(earnings) < 300
return 0;
if calculateSalary(earnings) < 400
return 1;
if calculateSalary(earnings) < 500
return 2;
if calculateSalary(earnings) < 600
return 3;
if calculateSalary(earnings) < 700
return 4;
if calculateSalary(earnings) < 800
return 5;
if calculateSalary(earnings) < 900
return 6;
if calculateSalary(earnings) < 1000
return 7;
getch();
return 0;
}