My code satisfies the 15% discount with the loyalty card and the 10% discount is over 100. They do not combine either after testing since I used "else if." I am confused as to how to do the additional 1% discount for every extra $25 over 100 dollars in conjunction with the already 10% discount. I assume I have to do a loop? If that is correct, but I am not familiar with loops and I wouldn't know how to set up the additional discount. Thank you for your time!~
P.S: I am in no way asking for anyone to tell me the answer to my assignment! I read the rules on homework. I just gave the assignment instructions and my code for context. I have no previous experience with c++ and the first time I saw it was three weeks ago. I would just appreciate some insight into how to solve this. I am not trying to cheat or anything! I just really need help understanding... :)
from line 26 you may do something like this (no loops)
26 27 28 29 30 31 32 33 34 35
elseif (total >= 100)
{
int totdisc=0;
totdisc=(total-100)/25;//this is int so it will only return int and leve the remainder
//using float for type casting
discountPercentage = 0.10+((float)totdisc/100);//this will add the 100th of total disc
}//i.e. for 1 totaldisc the disc percent will be 1/100=0.01