Ok guys (and gals)
This is what I have so far.
Code:
#include <stdio.h>
#define TOP_INCOME 100
#define TOP_TIER 80
#define BOTTOM_TEN 400.0
#define BOTTOM_TWENTY 500.0
#define BOTTOM_FIFTY 850.0
#define BOTTOM_SEVENTYFIVE 1487.0
#define BOTTOM_EIGHTYFIVE 2182.0
#define TOP_TEN 25400.0
#define TOP_FIVE 33700.0
#define TOP_ONE 47500.0
int main ()
{
//Would scan right here
//lets say scan returned 40,000
int userIncome=0;
int overBottomOfTier=0;
int tierRange=0;
float percent=0;
float percentAboveTierBottom;
printf("Please Enter Your Yearly Income:\n\n");
//for some reason I think it looks cleaner to do 2 new lines
scanf("%d", &userIncome);
if (userIncome<BOTTOM_TEN)
printf("Your in the bottom 10 percent\n");
else if (userIncome>=BOTTOM_TEN && userIncome<BOTTOM_TWENTY)
{
percent = 10.0 + ((userIncome-BOTTOM_TEN)/(BOTTOM_TWENTY-BOTTOM_TEN) * (10.0-1.0));
printf("You are %f percent richer\nthan the rest of the world\n\n", percent);
}
else if (userIncome>=BOTTOM_TWENTY && userIncome<BOTTOM_FIFTY)
{
percent = 20.0 + ((userIncome-BOTTOM_TWENTY)/(BOTTOM_FIFTY-BOTTOM_TWENTY) * (40.0-1.0));
printf("You are %f percent richer\nthan the rest of the world\n\n", percent);
}
else if (userIncome>=BOTTOM_FIFTY && userIncome<BOTTOM_SEVENTYFIVE)
{
percent = 50.0 + ((userIncome-BOTTOM_FIFTY)/(BOTTOM_SEVENTYFIVE-BOTTOM_FIFTY) * (25.0-1.0));
printf("You are %f percent richer\nthan the rest of the world\n\n", percent);
}
else if (userIncome>=BOTTOM_SEVENTYFIVE&& userIncome<BOTTOM_EIGHTYFIVE)
{
percent = 75.0 + ((userIncome-BOTTOM_SEVENTYFIVE)/(BOTTOM_EIGHTYFIVE-BOTTOM_SEVENTYFIVE) * (10.0-1.0));
printf("You are %f percent richer\nthan the rest of the world\n\n", percent);
}
else if (userIncome>=BOTTOM_EIGHTYFIVE && userIncome<TOP_TEN)
{
percent = 85.0 + ((userIncome-BOTTOM_EIGHTYFIVE)/(TOP_TEN-BOTTOM_EIGHTYFIVE) * (5.0-1.0));
printf("You are %f percent richer\nthan the rest of the world\n\n", percent);
}
else if (userIncome>=TOP_TEN && userIncome<TOP_FIVE)
{
percent = 90.0 + ((userIncome-TOP_TEN)/(TOP_FIVE-TOP_TEN) * (5.0-1.0));
printf("You are %f percent richer\nthan the rest of the world\n\n", percent);
}
else if (userIncome>=TOP_FIVE && userIncome<TOP_ONE)
{
overBottomOfTier=userIncome-TOP_FIVE;
tierRange=TOP_ONE - TOP_FIVE;
printf("your income is %d\n\n", userIncome);
printf("You are %d over the bottom of top five percent\n\n", overBottomOfTier );
printf("There is a %d difference between\n the bottom and top of the tier you are in\n\n", tierRange);
percentAboveTierBottom=(overBottomOfTier/tierRange)* 100.0;
printf("you are %f above the bottom of your tier\n\n", percentAboveTierBottom);
percent = 95.0 + ((userIncome-TOP_FIVE)/(TOP_ONE-TOP_FIVE) * (5.0-1.0));
printf("OK! (fingers crossed)You are %f\nricher than the rest of the world\n\n", percent);
}
else if (userIncome>TOP_ONE)
{
printf("You are top 1 percent");
}
else{
printf("does not compute\n");
printf("Can I Borrow 5000 Bucks");
}
if(percent>=50)
{
printf("\n\n\nCan I Borrow 5 Bucks");
}
return 0;
}