Hi all!!! I have been tearing my hair out trying to figure out how to make the below program calculate and display the total sales tax for each location. If anyone can please look at my code and send me in the right direction, I am hoping I can get this figured out. Thanks in advance!!
#include <stdlib.h>
#include <stdio.h>
int main()
{
/*Some food items and all non-food items are subject to a statewide sales tax and local*/
/*district taxes. Due to differences in district taxes, each store uses a different tax rate*/
int iResponse = 0;
float PurchaseAmount = 0;
float TotalAmt = 0;
float TotalSale = 0;
const float Sale = 0;
short DelMarSold = 0;
short EncinitasSold = 0;
short LaJollaSold = 0;
char str_DelMar[] = "Del Mar", str_Encinitas[] = "Encinitas", str_LaJolla[] = "La Jolla";
/*The above is the three districts*/
double tax_DelMar = 7.25, tax_Encinitas = 7.5, tax_LaJolla = 7.75;
/*The above is the distinct district taxes for the three districts*/
char s;
char mychar;
/*This is to ensure the user of this program knows what the purpose of this program is*/
printf("\nThis is a program to calculate the taxes on articles\n");
printf("\npurchased at a price the user chooses, depending on the district.\n");
/*The user needs to choose which option they want*/
printf("\nFor the district Del Mar, please press 1.\n");
printf("\nFor the district Encinitas, please press 2.\n");
printf("\nFor the district La Jolla, please press 3.\n");
/*Added the option to exit for users*/
printf("\nTo exit, please press 0.\n");
scanf ("%d", &iResponse);
/*Once the user chooses the district, the user must input the dollar amount of the purchase*/
printf("\nPlease enter the purchase amount.\n");
scanf ("%f", &PurchaseAmount);
while (iResponse = 0) {
if (iResponse == 1)
printf("\nThe tax for the purchase at the price of $%.2f in district %s is $%.2f, for a total of $%.2f\n",PurchaseAmount,str_DelMar, (PurchaseAmount * tax_DelMar / 100), PurchaseAmount + (PurchaseAmount * tax_DelMar / 100));
else
if (iResponse == 2)
printf("\nThe tax for the purchase at the price of $%.2f in district %s is $%.2f for a total of $%.2f\n ",PurchaseAmount,str_Encinitas, (PurchaseAmount * tax_Encinitas / 100), PurchaseAmount + (PurchaseAmount * tax_Encinitas / 100));
else
if (iResponse == 3)
printf("\nThe tax for the purchase at the price of $%.2f in district %s is $%.2f for a total of $%.2f\n ",PurchaseAmount,str_LaJolla, (PurchaseAmount * tax_LaJolla / 100), PurchaseAmount + (PurchaseAmount * tax_LaJolla / 100));
}
getch();
return 0;
}
:confused: