❔ Help ME PLEASE C#

i using MAUI to make a tip calculator The user enter the cost and the click at button with 10% or 15% OR 20% I have a class which contain the tip function Should the class also contain the final price funciton
6 Replies
TheAjayEffect
TheAjayEffectOP2y ago
TheAjayEffect
TheAjayEffectOP2y ago
Florian Voß
Florian Voß2y ago
rather than creating different TipPercentage methods, create just a single one and take the percentage amount as an argument
Should the class also contain the final price funciton?
sure, why not.
TheAjayEffect
TheAjayEffectOP2y ago
i have no idea how to do that
Florian Voß
Florian Voß2y ago
public double Tip(int percentage){

}
public double Tip(int percentage){

}
now this method can be implemented to Tip any possible percentage, this way you avoid repeating code
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server