• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 893
  • Last Modified:

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
#include<stdio.h>
/*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;
      break;
      }
 case Encinitas:{
      rate = 7.5;
      break;
     
 case La Jolla:
      rate = 7.75;
      break;
     
}
int main()
{
     int task;
     char c;
     float myAmount;
     do
     {
         
0
nellia
Asked:
nellia
1 Solution
 
Kent OlsenData Warehouse Architect / DBACommented:
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!
Kent
0
 
nelliaAuthor Commented:
But it actually compiled, gave me a linker error only.  Usually I get a compiler error.  Unbalance?
0
 
Kent OlsenData Warehouse Architect / DBACommented:
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.


Kent
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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
0
 
Infinity08Commented:
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 ...
0
 
cwwkieCommented:
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.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now