• C

Tax calculator with menu

This is my project and this is what I have so far, it wa able to compile but there is a linker error.  
Project: Tax calculator that multiply the tax rate by the purchase amount 100.00.  Then I have to modify the
simple tax calculator by adding a menu.  Itried to combine the two in one project and was able to compile, but have a linker error:

This is what I have
/*DelMar = 7.25 %/
/*Encinitas = 7.50%/
/*La Jolla = 7.75%/

printf("Tax Calculator\n");
//prompt the user to enter amounts
printf("\nSelect (a) calculate tax\n");
printf("\nSelect (0) to exit\n");
scanf("%c", &userSelect);
tax=price*0.0725;// Del Mar tax calculation
tax=price*0.0750;//Encinitas tax calculation
tax=price*0.0775;//La Jolla tax calculation
switch (task){
 case 1: DelMar:
      rate = 7.25;
 case Encinitas:{
      rate = 7.5;
 case La Jolla:
      rate = 7.75;
int main()
     int task;
     char c;
     float myAmount;
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kent OlsenDBACommented:
Hi nellia,

You should have several compilation errors.  You have unbalance { } all over the place.  The linker error is probably coming from the fact that the program won't compile so your object file has no main() function.

Good Luck!
nelliaAuthor Commented:
But it actually compiled, gave me a linker error only.  Usually I get a compiler error.  Unbalance?
Kent OlsenDBACommented:
Hi nellia,

Check out main.  You have two lefts, the second one initiates an incomplete do/while.

You've got code outside of any function.  The line:

printf("Tax Calculator\n");

and those following it can never get executed.

Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

nelliaAuthor Commented:
Linker Error (Severity 4)
      Module "cruntime.asm" in file "c:\program files\miracle c\ccl.lib "
      references unresolved external "_main"
      at offset 0092H in segment "_text".

Is what I am getting
That is because of what Kdo said : your main .c file didn't compile, so when the linker looked for it it couldn't find the compiled object file for it ... hence the error.

What compiler are you using ?

Start by putting your code INSIDE the main() function ...
On line 2 you start a comment, which is not ended,

/*DelMar = 7.25 %/

(it should end with a */  )

So the whole file is treated as a comment, and nothing gets compiled. A compiler *should* give an error about the comment which is not ended, but it seems your compiler does not.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.