This is what i have so far, but i need help trying to fix the tax so that it can
ID: 653733 • Letter: T
Question
This is what i have so far, but i need help trying to fix the tax so that it can work correctly can someone help me
#include <stdio.h>
int main()
{
float cost,labourCost,discountcost,Tax; /*I declared variables in float to
reduce loss of precision*/
int discount,length,width,area; /*Here i declared usable integer varibles*/
printf("Enter length in feet (integer):");
scanf("%d",&length); /*Reading length from user */
printf(" Enter width in feet (integer): ");
scanf("%d",&width);/*Reading width from user */
printf(" Enter Discount rate: ");
scanf("%d",&discount);/*Reading discount from user */
printf(" Enter Cost per square ft. (float): ");
scanf("%f",&cost);/*Reading cost per square feet from user */
printf(" Length: %d ",length); /*Printing length */
printf(" Width: %d",width);/*Printing the width */
area=length*width;/*calculating the area */
labourCost=0.35*area;/*calculating labour cost which is used at printing output */
discountcost=(area*cost*discount*0.01);/*calculating the discount cost */
Tax=(.07*Sub total);
printf(" Area is: %d",length*width);/*This is where I print the program */
/*------------------------Calculatoins Here-------------------------- */
printf(" Charges");
printf(" Description Cost Per Sq. Ft Charges");
printf(" ----------- --------------- ----------");
printf(" carpet %f %f",cost, (area*cost));
printf(" Labour 0.35 %f", labourCost);
printf(" Installed Price %f", ((area*cost)+labourCost));
printf(" Discount %d %f",discount, discountcost);
printf(" Sub total %f", ((area*cost)+labourCost)-discountcost);
printf(" Tax %d %f, (.07*Sub Total)");
printf(" Total %f", ((area*cost)+labourCost)-discountcost+Tax);
return 0;
}
This is C programming
Explanation / Answer
MADE THE CHANGES IN BOLD
===============================================
#include <stdio.h>
int main()
{
float cost,labourCost,discountcost,Tax, sub_total; /*I declared variables in float to reduce loss of precision*/
int discount,length,width,area; /*Here i declared usable integer varibles*/
printf("Enter length in feet (integer):");
scanf("%d",&length); /*Reading length from user */
printf(" Enter width in feet (integer): ");
scanf("%d",&width);/*Reading width from user */
printf(" Enter Discount rate: ");
scanf("%d",&discount);/*Reading discount from user */
printf(" Enter Cost per square ft. (float): ");
scanf("%f",&cost);/*Reading cost per square feet from user */
printf(" Length: %d ",length); /*Printing length */
printf(" Width: %d",width);/*Printing the width */
area=length*width;/*calculating the area */
labourCost=0.35*area;/*calculating labour cost which is used at printing output */
discountcost=(area*cost*discount*0.01);/*calculating the discount cost */
sub_total=((area*cost)+labourCost)-discountcost;
Tax=(.07*sub_total);
printf(" Area is: %d",length*width);/*This is where I print the program */
/*------------------------Calculatoins Here-------------------------- */
printf(" Charges");
printf(" Description Cost Per Sq. Ft Charges");
printf(" ----------- --------------- ----------");
printf(" carpet %f %f",cost, (area*cost));
printf(" Labour 0.35 %f", labourCost);
printf(" Installed Price %f", ((area*cost)+labourCost));
printf(" Discount %d %f",discount, discountcost);
printf(" Sub total %f", sub_total);
printf(" Tax %d %f", Tax);
printf(" Total %f", sub_total+Tax);
return 0;
}
=========================================================
Hope my answer helped. Please kindly rate my answer :)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.