I changed some things and I can get it to add but not multiply.
I am trying to find that in my text. I tried adding a constant, but I 
am not sure if I did it right or even if I need one. Did I use the 
conversion specifier correctly?

Here is the code
/*original version*/
/*Version 2 deleted extra semi colons*/
/*version 3 added braces*/
/*version 4 added conversion specifier*/


#include <stdio.h>
#include <math.h>
main()
{
    /*setting variables for store choice*/
   int iResponse;
    float fSales;
    float fTax1;
    float fTax2;
    float fTax3;
    const cTotal1;
    const cTotal2;
    const cTotal3;
    
    /*initializing variables*/
    iResponse = 0;
    fSales = 0;
    fTax1 = .0725;
    fTax2 = .075;
    fTax3 = .0775;
    const cTotal1 = fTax1 * fSales;
    const cTotal2 = fTax2 * fSales;
    const cTotal3 = fTax3 * fSales;
   
    /*function for selecting store location*/
    printf ("\n\tStore location");
    printf ("\n1\t Del Mar\n");
    printf ("\n2\t Encinitas\n");
    printf ("3\t La Jolla\n");
    printf ("\nEnter the number of your store location: ");
    scanf ("%d", &iResponse);
   
   /*function for inputing sales*/
    printf ("\nEnter amount of purchase:");
    scanf ("%f", &fSales);
    
    /*function for conditions*/
     if (iResponse ==1){
        printf ("\nYour tax is: %f", fTax1 * fSales);
        printf ("\nYour total is: %c", cTotal1);
        }
     if (iResponse ==2){
        printf ("\nYour tax is: %f\n", fTax2 * fSales);
        printf ("\nYour total is: %c\n", cTotal2);
        }
     if (iResponse ==3){
        printf ("\nYour tax is: %f", fTax3 * fSales);
        printf ("\nYour total is: %c", cTotal3);
        }
     if (iResponse > 3)
     printf ("\nYour choice has to be 1,2 or 3\n");
     
    }
    

Reply via email to