What am I doing wrong? Code?
I am making a tax calculator for my last week of my UOP programming class, it's my last class and I need help trying to figure out how to make an exit command. I am also getting my code ot compile but when it comes to the sales amount it will configure it plus give me the error message that I made to input a value for money. I f I am making sense can someone help me please? Oh yah this is an accelerated class so bare with me please.
Code:
//------------------------------------------------------------/
//Program Name: TaxCalc.c //////////
//Written By: Jerald Komer //////////
//Date: June 27, 2007 //////////
//Description: Week 5 Individual Assignment //////////
// POS370 John Tatum //////////
// University of Phoenix //////////
//------------------------------------------------------------/
//------------------------
// Specific Functions
//------------------------
#include <stdio.h>
#include <stdlib.h>
//----------//
// Main //
//----------//
main()
{
//---------------////////////////////////
//Variables//////////////////////////////
//---------------////////////////////////
int iSelection=0;
float input_Valid=0;
float z=0;
float e=.0725;
float f=.075;
float g=.0775;
//User View////////////////////////////////////////////////////
printf("\nTax generated from sales for Kudler Fine Foods\n");
printf("Three locations with the following tax rates.\n\n\n");
printf("\n");
//Tax rates for each location////////////////////////////
printf("Kudler Del Mar Location\t\t\t\t 7.25%%\n");
printf("Kudler Encinitas Location\t\t\t 7.5%%\n");
printf("Kudler La Jolla Location\t\t\t 7.75%%\n\n");
printf("\n");
printf("\n");
///// Input Location/////////////////////////////////
printf("1\tKudler Del Mar Location\n");
printf("2\tKudler Encinitas Location\n");
printf("3\tKudler La Jolla Location\n");
printf("4\tExit Menu\n");
printf("\n");
printf("\n");
printf("\tEnter selection (1-4):");
printf("\n");
//Sale amount
do
{
printf("\n");
printf("\n\tPlease enter your selection:\t");
input_Valid=scanf("%d",&iSelection);
if(!input_Valid)
{
printf("\n\n Error:Incorrect Entry Type-Must be selection (1-4)!\n\n");
system("pause");
}
fflush(stdin);
rewind(stdin);
}while(!input_Valid);
///loop ends
///amount///
do
{
printf("\n Sale Amount:\t");
input_Valid=scanf("%f",&z);
if(!input_Valid);
{
printf("\n\n Error:Incorrect Entry Type-Must be money format!\n\n");
}
fflush(stdin);
rewind(stdin);
}while(!input_Valid);
//// Store selection/////
if (iSelection==1)//////Del Mar///////
{
printf("\nYour transaction amount input is:\t%.2f\n", z);
printf("\nThe tax result for Del Mar is:\t\t%.2f\n", z*e);
printf("\nThe total amount for Del Mar location is:\t%.2f\n\n", z*e+z);
}
if (iSelection==2)///// Encinitas//////
{
printf("\nYour transaction amount input is:\t%.2f\n", z);
printf("\nThe tax result for Encinitas is:\t\t%.2f\n", z*f);
printf("\nThe total amount for Encinitas location is:\t%.2f\n\n", z*f+z);
}
if (iSelection==3)/////La Jolla/////////
{
printf("\nYour transaction amount input is:\t%.2f\n", z);
printf("\nThe tax result for La Jolla is:\t\t%.2f\n", z*g);
printf("\nThe total amount for La Jolla location is:\t%.2f\n\n", z*g+z);
}
if (iSelection==4)/////Exit/////////
{
printf("\nExit\n");
}
system("pause");
}