Here is my current code for a calculator; I'm struggling in getting it to display the fourth category total amount which would be sale amount + tax sales amount. Any hints here would be appreciated.
Code:
#include <stdio.h>
#define DelMar 7.25
#define Encinitas 7.5
#define LaJolla 7.75
float user_input(){
float amount;
printf("Please input sales amount\n");
scanf("%f", &amount);
return amount;
}
int main(){
float sales = 125.00;
sales = user_input();
if (sales < 0.00) {
printf("A sale cannot be negative. Please try again");
exit(-1);
}
printf("Tax Calculator for Kudler Fine Foods\n\n\n");
printf("Store Location\tSales Amount\tTax Percentage\tTax Amount\tTax Amount\tTotal Amount\n");
printf("Del Mar Store\t$%.2f\t\t%.2f%%\t\t%.2f%\t\n",sales, DelMar, sales*DelMar/100);
printf("Encinitas Store\t$%.2f\t\t%.2f%%\t\t%.2f%\t\n",sales, Encinitas, sales*Encinitas/100);
printf("La Jolla Store\t$%.2f\t\t%.2f%%\t\t%.2f%\t\n",sales, LaJolla, sales*LaJolla/100);
printf(" Press the enter key to exit the calculator\n");
getch();
return 0;
}