#include <iostream>

class Apple
{
public:
  Apple(int num, float unitCostPrice, float unitSellPrice) : 
    m_inventory(num),
    m_unitCostPrice(unitCostPrice),
    m_unitSellPrice(unitSellPrice) {}

  float totalCostPrice() const { return m_inventory * m_unitCostPrice; }
  float totalSellPrice() const { return m_inventory * m_unitSellPrice;}
  float netProfit() const { return totalSellPrice() - totalCostPrice(); }
private:
  int m_inventory;
  float m_unitCostPrice;
  float m_unitSellPrice;
};

class Orange
{
public:
  Orange(int num, float unitCostPrice, float unitSellPrice) : 
    m_inventory(num),
    m_unitCostPrice(unitCostPrice),
    m_unitSellPrice(unitSellPrice) {}

  float totalCostPrice() const { return m_inventory * m_unitCostPrice; }
  float totalSellPrice() const { return m_inventory * m_unitSellPrice;}
  float netProfit() const { return totalSellPrice() - totalCostPrice(); }
private:
  int m_inventory;
  float m_unitCostPrice;
  float m_unitSellPrice;
};

template <typename Fruit>
void print_net_profit(const Fruit & fruit)
{
  std::cout << "Net profit at current prices = $ " << fruit.netProfit() << std::endl;
}

int main()
{
  Apple apple(100, 4.00, 4.25);
  Orange orange(50, 7.00, 7.25);
 
  print_net_profit(apple);
  print_net_profit(orange);
}
