Purchase Solution

flow chart looping the program code

Not what you're looking for?

Ask Custom Question

//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

Purchase this Solution

Solution Summary

A flow chart looping the program code is embedded.

Purchase this Solution


Free BrainMass Quizzes
Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Javscript Basics

Quiz on basics of javascript programming language.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.