Code:/*Purpose: Check user's input for validity. Have the user select from the menu which store to use for tax calculation. Calculate and display the tax amount for the store selected, and the total sale amount for that store. */ /********************************************************/ #include <stdio.h> /* Header file */ int main (void) /* Main function for the program */ { int Store_No; /*Initialize Variables*/ float fAmt = 0.00; /*Amount the user will input*/ float fDelMar = 0.00; /*DelMar Tax result based on user input*/ float fEncinitas = 0.00; /*Encinitas Tax result based on user input*/ float fLaJolla = 0.00; /*LaJolla Tax result based on user input*/ float fDelMarResult = 0.00; /*Total amount plus tax result*/ float fEncinitasResult = 0.00; /*Total amount plus tax result*/ float fLaJollaResult = 0.00; /*Total amount plus tax result*/ printf("Welcome to Kudler Fine Foods!!\n"); printf("Make Your Store Selection from the list Below:\n\n"); printf(" Store No.\tStore\n\n"); printf("\t1.\tDel Mar\n"); printf("\t2.\tEncinitas\n"); printf("\t3.\tLa Jolla\n"); printf("\n\t4.\tExit\n"); printf("\nPress 4 to exit.\n"); /*while (Store_No !=4)*/ printf("Please enter a Store No. : "); while (scanf("%f", &Store_No) != 1) { while (getchar() != '\n'); printf("Your input is not valid. Please enter a store No.: "); } /*if (Store_No != 4)*/ { printf("Please enter the purchase amount:"); /* Prompt the user for the amount */ while (scanf("%f", &fAmt) != 1) { while (getchar() != '\n'); /*Validate the input*/ printf("Your input is not Valid. Please, try again: "); /* Notify the user if the input is valid or not */ } printf ("You entered %.2f\n", fAmt); switch (Store_No) { case 1: fDelMar=fAmt*.0725; fDelMarResult=fDelMar + fAmt; printf("\nThe tax for $%.2f in DelMar is $%.2f, with total of $%.2f\n", fAmt, fDelMar, fDelMarResult); /*Display results*/ break; case 2: fEncinitas=fAmt*.075; fEncinitasResult=fEncinitas + fAmt; printf("\nThe tax for $%.2f in Encinitas is $%.2f, with total of $%.2f\n", fAmt, fEncinitas, fEncinitasResult); /*Display results*/ break; case 3: fLaJolla=fAmt*.0775; fLaJollaResult=fLaJolla + fAmt; printf("\nThe tax for $%.2f in LaJolla is $%.2f, with total of $%.2f\n", fAmt, fLaJolla, fLaJollaResult); /*Display results*/ break; case 4: printf("Quitting program!\n"); exit(0); return 0; default: printf("\nSorry, the Store No. you entered was not on the menu. Please try again! "); } } } /**************************************************************/