Syntax Object Oriented Code Work Code Please Explain Code Using Comments Include Include U Q37143293

How does the SYNTAX of the object oriented code work onthe code below? If you can, please explain it in the code using //comments.

#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 = 99.0;

   int unitsSold; // Number of unitssold
   double discountPct, totalCost;

   // Get the number of

OR
OR

Leave a Comment

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