-
-
Save mstefarov/4173705 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 | |
{ | |
const double percentIncrease = 0.09; | |
static void Main(string[] args) | |
{ | |
int[] grossSales = new int[] | |
{ | |
200, | |
1100, | |
500, | |
700, | |
400, | |
5500, | |
290, | |
9050, | |
1026, | |
890, | |
}; | |
int[] numOfSalariesInThatCategory = new int[9]; | |
for(int i = 0; i<grossSales.Length; i++) | |
{ | |
int totalPay = 200 + (int)Math.Round(grossSales[i] * percentIncrease); | |
if (totalPay >= 200 && totalPay < 1000) | |
{ | |
numOfSalariesInThatCategory[totalPay / 100 - 2]++; | |
} | |
else if (totalPay >= 1000) | |
{ | |
numOfSalariesInThatCategory[8]++; | |
} | |
} | |
Console.WriteLine("The amounts within salary categories are as follows:"); | |
for(int i = 0; i<numOfSalariesInThatCategory.Length; i++) | |
{ | |
Console.WriteLine(numOfSalariesInThatCategory[i]); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment