Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote