What is wrong with these pointers (C programming)?
include
#include
#define TAX_RATE 1.25
#define UTILITY_COST 300.0
#define INSURANCE_COST 550.0
void input(float*, float*, float*);
void calc(float, float, float, float, float, float, float, float);
float calcDplomo(float, float, float, float*, float*, float*, float*, float*);
void output(float, float, float, float, float, float, float, float);
int main(void)
{
float sellp;
float anir;
float loand;
float downp;
float amtl;
float mortg;
float propt;
float mtot;
input(&sellp, &anir, &loand);
calc(sellp, anir, loand, downp, amtl, mortg, propt, mtot);
output(sellp, anir, loand, downp, amtl, mortg, propt, mtot);
return 0;
}
void input(float* sellp, float* anir, float* loand)
{
printf(“\n\t\t Brian’s Mortgage Calculation Program\n”);
printf(“\nEnter the property’s selling price: \n”);
scanf(“%f”,sellp);
printf(“\nEnter the annual rate of interest: \n”);
scanf(“%f”,anir);
printf(“\nEnter the duration (years) of the loan: \n”);
scanf(“%f”,loand);
return;
}
void calc(float sellp, float anir, float loand, float downp, float amtl, float mortg, float propt, float mtot)
{
calcDplomo(sellp, anir, loand, &downp, &amtl, &mortg, &propt, &mtot);
return;
}
float calcDplomo(float sellp, float anir, float loand, float* downp, float* amtl, float* mortg, float* propt, float* mtot)
{
float cdown = .2;
float mins;
*propt = sellp * (TAX_RATE/100)/12;
mins = INSURANCE_COST/12;
*mtot = *mortg + UTILITY_COST + *propt + mins;
*downp = sellp * cdown;
*amtl = sellp – *downp;
*mortg = *amtl * anir/12*(1+anir/12) * loand *12/(1+anir/12) * loand *12-1;
return mins;
}
void output(float sellp, float anir, float loand, float downp, float amtl, float mortg, float propt, float mtot)
{
printf(“\nMONTHLY COST OF HOUSE\n”);
printf(“\nSELLING PRICE $ %9.2f”,sellp);
printf(“\nDOWN PAYMENT %9.2f”,downp);
printf(“\nAMOUNT OF LOAN %9.2f”,amtl);
printf(“\nINTEREST RATE %9.1f%%”,anir);
printf(“\nTAX RATE %9.1f%%”,TAX_RATE);
printf(“\nDURATION OF LOAN (YEARS) %9.0f\n”,loand);
printf(“\nMONTHLY PAYMENT\n”);
printf(“\nMORTGAGE %9.2f”,mortg);
printf(“\nUTILITIES %9.2f”,UTILITY_COST);
printf(“\nPROPERTY TAXES %9.2f”,propt);
printf(“\nUTILITIES %9.2f\n”,INSURANCE_COST);
printf(” __________”);
printf(” $ %9.2f\n”,mtot);
return;
}
Trial run:
Brian’s Mortgage Calculation Program
Enter the property’s selling price:
600000
Enter the annual rate of interest:
2.2
Enter the duration (years) of the loan:
30
MONTHLY COST OF HOUSE
SELLING PRICE $ 600000.00
DOWN PAYMENT -107374176.00
AMOUNT OF LOAN -107374176.00
INTEREST RATE 2.2%
TAX RATE 1.3%
DURATION OF LOAN (YEARS) 30
MONTHLY PAYMENT
MORTGAGE -107374176.00
UTILITIES 300.00
PROPERTY TAXES -107374176.00
UTILITIES 550.00
__________
$ -107374176.00
Press any key to continue
I know it has to do with the function call in void calc calcDplomo(sellp, anir, loand, &downp, &amtl, &mortg, &propt, &mtot); But how do I fix it?
Categories: Mortgage Tags: 2f, amtl, c programming, duration, mortgage calculation, pointers, rate of interest, return void, scanf, tax rate
Company forcing change to payment plan
Hi, Last year I was a member of Zipcar in NY. Under this membership, in June my brother who was not a member drove a car under my account & was involved in an accident
Categories: Mortgage Tags: accepted-full, approved-via, balance, Brother, covered-under, duration, email, membership, membership rules, original-plan, Payment, proper-channels, the-membership, until-the-car, zipcar
Can you sublet against your roommate’s will?
I know two people who are on a lease -- Friend and EvilOne.
Categories: Mortgage Tags: Current, current-place, duration, friend, landlord-tenant, leasing-office, life hell, ordeal, place friend, place-starting, really-giving, roommate, spite, Straight, straight answers, sublet-the-new, subletter, work-it-out, wrenches
Categories: Mortgage Tags: 5 months, contract, duration, employer, employer-didnt, exempt-or-not, expire-on-sept, family, first-question, general - misc topics, h1 visa, h4 visa, India, india-on-aug, know-the-steps, legal-eligible, petition, quota, TIME, time duration, usa, usa visa, visa holder, whether-it-cap
Overnight guest refuses to leave months later
I live in a San Francisco studio with a lease that prohibits other people from residing with me. I have a guest that has been staying with me for 7 months
Categories: Mortgage Tags: 7 months, duration, francisco, his-welcome, landlord, landlord-tenant, overnight guest, People, residence, rights-because, san francisco studio, subtenant, the-residence
Continuation of benefits if WC is from old employer
If an employee sporadically misses work and then ultimately goes on WC related to an old employers injury and claim, do I need to continue paying the employee their salary and benefits while they are not performing any work for me? If I continued their salary and benefits expecting a short duration, which was not the case, do I have any recourse from the old employer or their wc carrier to reclaim any of those expenditures