In: Computer Science
*C programming*
My friend Steve wants to buy something nice for himself. He doesn't know want he wants yet but he is thinking of spending $1,000 on it or more. He makes $500 a month and has a monthly living expense of $325. He also has a lot of bi-monthly subscription payments which costs him $450 every other month ($450 is the bimonthly expenses) . He wants to know when he will be able to buy want he wants and still be able to pay his bills. He can work normal hours or work overtime and earn an extra $150 a month. Other things to consider are the tax rate (which is seven percent) and the amount of money he already has.
#include <stdio.h>
int main()
{
int spend=1000,count=0;//Steve wants to spend money
for him
int month=500;//monthly salary
int liv=325;//monthly living expenses
int bi_m=450;// bi-monthly expenses
int extra=150;//extra earn
float has,interest=500*0.007;
printf("Enter amount of money he already has:
\t");
scanf("%f",&has);
if (has>=1000)
printf("\nSteve can buy what he
wants now\n");
else
{
while (has<spend)
{
has+=month-interest-liv-bi_m/2+extra;
count++;
}
printf("\nSteve can buy what he
wants after %d months\n",count);
return 0;
}
}#include <stdio.h>
int main()
{
int spend=1000,count=0;//Steve wants to spend money
for him
int month=500;//monthly salary
int liv=325;//monthly living expenses
int bi_m=450;// bi-monthly expenses
int extra=150;//extra earn
float has,interest=500*0.007;
printf("Enter amount of money he already has:
\t");
scanf("%f",&has);
if (has>=1000)
printf("\nSteve can buy what he
wants now\n");
else
{
while (has<spend)
{
has+=month-interest-liv-bi_m/2+extra;
count++;
}
printf("\nSteve can buy what he
wants after %d months\n",count);
return 0;
}
}