Explore BrainMass
Share

# flow chart looping the program code

//student name
#include <stdio.h>
main ()
{
//declare variables
float fStore1=.0725; //use floats due to possibility of using decimals
float fStore2=.075; //here is where taxes are hard coded in the program
float fStore3=.0775;
int iStore=0;
float fPurchase=0.0;
float fTax=0.0;
float fTotal=0.0;

printf("student name,C Programming Service Request, February26,2007n");
printf("n1. Del Mar-7.25n");
printf("n2. Encinitas-7.5n");
printf("n3. LaJolla-7.75n");
printf("nEnter store number: ");
scanf("%d", &iStore); //store the store number entered to use later
switch (iStore)
{
case 1: //if store selected is number 1 then do all tasks below
printf("nEnter amount from sale:");
scanf("%f", &fPurchase); //store sale amount
fTax=fPurchase* fStore1; //declare value for tax-purchase times 7.25% tax
printf("nThe taxes are: \$%.2fn",fTax);
fTotal=fTax + fPurchase; //calculation of total for Del Mar
printf("nThe total is : \$%.2fn", fTotal);
break;
case 2: //if store selected is number 2 then do all tasks below
printf("nEnter amount from sale:");
scanf("%f", &fPurchase);
fTax=fPurchase * fStore2; //declare value for tax-purchase times 7.5% tax
printf("nThe taxes are: \$%.2fn",fTax);
fTotal=fTax + fPurchase; //calculation of total for Encinitas
printf("nThe total is : \$%.2fn", fTotal);
break;
case 3: //if store selected is number 3 then do all tasks below
printf("nEnter amount from sale:");
scanf("%f", &fPurchase);
fTax=fPurchase * fStore3; //declare value for tax-purchase times 7.75% tax
printf("nThe taxes are: \$%.2fn",fTax);
fTotal=fTax + fPurchase; //calculation of total for LaJolla
printf("nThe total is : \$%.2fn", fTotal);
break;
} //end case statements
} //end program

#### Solution Summary

A flow chart looping the program code is embedded.

\$2.19