Created
November 30, 2012 02:46
-
-
Save anonymous/4173470 to your computer and use it in GitHub Desktop.
Counts the amount of pay grades in each category.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace ConsoleApplication1 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
int[] grossSales = new int[] | |
{ | |
200, | |
1100, | |
500, | |
700, | |
400, | |
5500, | |
290, | |
9050, | |
1026, | |
890, | |
}; | |
int b = 1; | |
double percentIncrease = 0.09; | |
int[] numOfSalariesInThatCategory = new int[9]; | |
for(int i = 0; i<9; i++) | |
{ | |
int totalPay = 200 + (int)Math.Round(grossSales[b] * percentIncrease); | |
if (totalPay >= 200 && totalPay < 1000) | |
{ | |
numOfSalariesInThatCategory[totalPay / 100 - 2]++; | |
} | |
else if (totalPay >= 1000) | |
{ | |
numOfSalariesInThatCategory[8]++; | |
} | |
++b; | |
} | |
b = 0; | |
Console.WriteLine("The amounts within salary categories are as follows:"); | |
do | |
{ | |
Console.WriteLine(numOfSalariesInThatCategory[b]); | |
++b; | |
}while(b <= 8); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment