no that is the thing, it does not hold the right value
if in get data for costSqf i typed
22.23
in that print statement you just mentioned it would print
2.00
here is the code i put into one file, take a look please.
Code:
/*chad.h*/
#include <stdio.h>
/*Prototype Declarations*/
#define lab_Cost 0.35
#define taxRate 0.085
/*main*/
#include "chad.h"
int main (void)
{
int roomLth;
int roomWth;
int custDsc;
float costSqf;
float install;
float subTotal;
float total;
/*Statements*/
getData(&roomLth, &roomWth, &custDsc, &costSqf);
printf("%6.2f is costSqf", costSqf);
calculate(roomLth, roomWth, custDsc, costSqf, &install,
&subTotal, &total);
/*
printResult(total);
*/
return 0;
}
/*getData*/
void getData (int *roomLth,
int *roomWth,
int *custDsc,
float *costSqf)
{
printf("Length of room (feet)? ");
scanf("%d", roomLth);
printf("Width of room (feet)? ");
scanf("%d", roomWth);
printf("Customer discount (percent)? ");
scanf("%d", custDsc);
printf("Cost per square foot (xxx.xx)? ");
scanf("%f", costSqf);
printf("%6.2f is correct\n", *costSqf);
return;
}
/*calc*/
#include "chad.h"
/*
This function calls three subfunctions.
*/
void calculate (int roomLth,
int roomWth,
int custDsc,
float costSqf,
float *install,
float *subTotal,
float *total)
{
/*statements*/
int a = roomLth;
int b = roomWth;
float c = costSqf;
int d = custDsc;
float e;
float f;
float g;
printf("\n %f is costSqf", costSqf);
g = calcInstall (a, b, c);
printf("\n %6.2f test\n", g);
e = calcSubTotal (g, d);
printf("\n%6.2f test subT \n", e);
/* calcTotal (e, &f);
*install = g;
*subTotal = e;
*total = f;
*/
return;
}
/*calcI*/
#include "chad.h"
/*
This calculates the installed price and cost.
*/
float calcInstall (int x, int y, float z)
{
int a;
float b;
float c;
float result;
printf("\n made it to calcI");
a = x * y;
b = z * a;
c = a * lab_Cost;
/*result = b + c;
*/
return (b + c);
}
/*calcS*/
#include "chad.h"
float calcSubTotal (float inst, int dis)
{
float mult;
int hun = 100;
float ans;
printf("\n %d is the dis", dis);
printf("\n%6.2f is install ", inst);
mult = inst * dis;
ans = mult;
return ans;
}
/*calcT*/
#include "chad.h"
void calcTotal (float e, float *f)
{
float a;
a = e * taxRate;
*f = a;
return;
}