Shadow-Ninja
asked on
% sign on the Miracle C Compiler
I want to give you all heads up. The Kudler Fine Foods Tax Calculator question is homework for sure. It is college or technical homework. The reason how I know is because I am in the middle of a class right now and that is our assignment. I am having problems with it but I seem to see a lot of questions on how to build a tax calculator. My intentions for being here is simple. I want to learn and since I am a visual learner it is way harder for me to asertain reading it. I do not want anyone to write the code for me, the questions I have are of specific nature. I hope this clears my intentions. If it seems like I am asking for more than that I am positively sure that I will be told about it, but keep in mind I am a beginner and if I am to learn it is by asking questions. All I ask is for a little help or guidance, no short cuts.
This is my first question
The significance in the percent sign. When I write 7.25% in the case staement it is in error.
here is what it looks like- case Del Mar:
rate = 7.25%;
break;
Now, since 7.25 is laready being multiplied by the total which is 125.00 in the program, is the percent sign throwing the compiler off becase it is not needed, or am I missing or over writing the lines? Thank you
Rob
This is my first question
The significance in the percent sign. When I write 7.25% in the case staement it is in error.
here is what it looks like- case Del Mar:
rate = 7.25%;
break;
Now, since 7.25 is laready being multiplied by the total which is 125.00 in the program, is the percent sign throwing the compiler off becase it is not needed, or am I missing or over writing the lines? Thank you
Rob
The percent sign is not necessary if you want to show a rate of 7.25% you can show it as rate=.0725. Symbols such as %,$,& always have a different meaning in programming. % is usually used to call a variable name such as %variablename% in code but it can be used for other things. Hope this helps.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The compiler knows nothing about the percent sign meaning "percent". So you have to write:
float percent;
percent = 0.075;
or a little bit clearer:
float percent;
percent = 7.5 / 100.0;
float percent;
percent = 0.075;
or a little bit clearer:
float percent;
percent = 7.5 / 100.0;