Add Setprice Public Method Classification Need Modify Calculatesales Public Member Functio Q37143339

How do I add a setPrice public method to theclassification. I need to modify the calculateSales publicmember function so that it does NOT pass the priceargument. The price attribute instead will be a private attributein the classification.

#include <iostream>
#include <iomanip>
using namespace std;

class SoftwareSales
{
private:
   double discount;
   int quantitySales;
public:
   void setQuantitySold(int s);
   void setDiscount(double d);
   double calculateTotalCost();
};

void SoftwareSales::setDiscount(double d)
{
   discount = d;
}

void SoftwareSales::setQuantitySold(int q)
{
   quantitySales = q;
}

double SoftwareSales::calculateTotalCost()
{
   double discountCost, totalCost;
   totalCost = quantitySales * 99.00;

   discountCost = 99.00 * discount;

   discountCost = quantitySales * discountCost;
   return totalCost – discountCost;
}

int main()
{
   SoftwareSales objSoftwareSales;

   // Constant for the unit price.
   const double UNIT_PRICE =

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.