This is the code I have so far
CODE
#include <stdio.h>
int main(void)
{
//Declare Variables
float fsubtotal, taxdelmar, taxencinitas, taxlajolla;
float fCost;//calculation operator
int iResponse = 0;
fCost = 0;
fsubtotal=125.00;
taxdelmar=.0725;
taxencinitas=.0775;
taxlajolla=.0750;
//Program Header
printf("\n\tKudler Fine Foods 'Sales Tax Calculator'\n");
printf("\n\t1. Del Mar\n");
printf("\n\t2. Encinitas\n");
printf("\n\t3. La Jolla\n");
printf("\n Please choose your Location (1,2, or 3)\n");
//Repeatedly get input until a number between 1 and 3 is entered
while(iResponse <= 0 || iResponse > 3)
scanf("%i", &iResponse);
if(iResponse ==1)
{
printf("\n Welcome Del Mar Associate.\n");
printf(" Please enter your sub-total: $");
scanf("\n%f", &fCost);//sale sub-total
printf(" --------------------------------\n");
printf(" Your total tax is $%.2f\n", fCost * .0725);//in-line calculation
printf(" The total amount owed is $%.2f\n", fCost * (1+.0725));//in-line calculation
}
else if(iResponse ==2)
{
printf("\n Welcome Encinitas associate.\n");
printf(" Please enter your sub-total: $");
scanf("%f", &fCost);//sale sub-total
printf(" --------------------------------\n");
printf(" Your total tax is $%.2f\n", fCost * .075);//in-line calculation
printf(" The total amount owed is $%.2f\n", fCost * (1+.075));//in-line calculation
}
else
{
printf("\n Welcome La Jolla associate.\n");
printf(" Please enter your sub-total: $");
scanf("%f", &fCost);//sale sub-total
printf(" --------------------------------\n");
printf(" Your total tax is $%.2f\n", fCost * .0775);//in-line calculation
printf(" The total amount owed is $%.2f\n", fCost * (1+.0775));//in-line calculation
}
getchar();
getchar();//keeps application viewable on screen
// end selection
return 0;
} de#include <stdio.h>
int main(void)
{
//Declare Variables
float fsubtotal, taxdelmar, taxencinitas, taxlajolla;
float fCost;//calculation operator
int iResponse = 0;
fCost = 0;
fsubtotal=125.00;
taxdelmar=.0725;
taxencinitas=.0775;
taxlajolla=.0750;
//Program Header
printf("\n\tKudler Fine Foods 'Sales Tax Calculator'\n");
printf("\n\t1. Del Mar\n");
printf("\n\t2. Encinitas\n");
printf("\n\t3. La Jolla\n");
printf("\n Please choose your Location (1,2, or 3)\n");
//Repeatedly get input until a number between 1 and 3 is entered
while(iResponse <= 0 || iResponse > 3)
scanf("%i", &iResponse);
if(iResponse ==1)
{
printf("\n Welcome Del Mar Associate.\n");
printf(" Please enter your sub-total: $");
scanf("\n%f", &fCost);//sale sub-total
printf(" --------------------------------\n");
printf(" Your total tax is $%.2f\n", fCost * .0725);//in-line calculation
printf(" The total amount owed is $%.2f\n", fCost * (1+.0725));//in-line calculation
}
else if(iResponse ==2)
{
printf("\n Welcome Encinitas associate.\n");
printf(" Please enter your sub-total: $");
scanf("%f", &fCost);//sale sub-total
printf(" --------------------------------\n");
printf(" Your total tax is $%.2f\n", fCost * .075);//in-line calculation
printf(" The total amount owed is $%.2f\n", fCost * (1+.075));//in-line calculation
}
else
{
printf("\n Welcome La Jolla associate.\n");
printf(" Please enter your sub-total: $");
scanf("%f", &fCost);//sale sub-total
printf(" --------------------------------\n");
printf(" Your total tax is $%.2f\n", fCost * .0775);//in-line calculation
printf(" The total amount owed is $%.2f\n", fCost * (1+.0775));//in-line calculation
}
getchar();
getchar();//keeps application viewable on screen
// end selection
return 0;
}
]