C# don’t understand calling methods. object oriented programming

What I understood is that you want to call a function to perform some calculations.

Before your last line:

Console.Write("Your Retail Price Is: " + newprice);

What you need to do is call your function for calculating price and it’ll return the price after calculating it. So simply do:

double newprice = sum(inputpercent,inputcost)

And change your sum function to:

public double sum(double MarkUpPercentage, double overallprice)
    {            
        MarkUpPercentage = inputpercent + 100;
        overallprice = MarkUpPercentage / 100;
        double newprice = inputcost * overallprice;
        return newprice;
    }

Leave a Comment