Assume a developer writes the following class that calculates an item\'s retail
ID: 3829853 • Letter: A
Question
Assume a developer writes the following class that calculates an item's retail price based on the wholesale cost and markup percentage. Describe how a unit test can be developed to test this class. You may use code in any language, pseudo code, or natural language.
public class RetailPriceCalculator
{
…
public static double calculateRetail(double wholesale, double markUp)
{
double retail = wholesale (1+ markup/100);
return retail;
}
}
Explanation / Answer
You can consider following test cases to test your functionality:
a. wholesale < 0 and markup < 0
b. wholesale <= 0 and markup > 0
c. wholesale < 0 and markup <= 0
d. wholesale == 0 and markup == 0
e. wholesale >=0 and markup < 0
f. wholesale > 0 and markup > 0
g. wholesale > 0 and markup > 100 (more than 100%)
Please let me know in case of any issue
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.