This is the code I have currently. Any pro tips is greatly appreciated! I know there's an issue because my Boolean if/else statement is only returning true. The program was made to take 3 doubles, the price of an item, the tax rate that would be added onto the item and the cash on hand. The program is supposed to run an if else statement stating whether or you're able to purchase said item (true) or if you won't be able to (false). Currently what I have has no errors in syntax but is only returning true. Thank you for your time in advance.
public static bool Test7(double price, double taxRate, double cashOnHand)
{
bool answer;
double total = price * taxRate;
if (total <= cashOnHand)
{
answer = true;
}
else
{
answer = false;
}
return answer;
}
Aucun commentaire:
Enregistrer un commentaire