예제 #1
0
void ProductOrder::print() {
    cout << "Name: " << prod.getName()
         << "\nPrice: "
         << prod.getPrice()
         << "\nQuantity: " << quantity
         << "\nTotal Amount: "
         << getTotal() << "\n";
}
   void setTotalPrice()
        {
          
           Product* sweeper = firstProduct;
           double suM=0;
         if(sweeper != NULL)
          {
           while(sweeper->getNextProduct() != NULL)
            {
               suM += sweeper->getPrice();
               sweeper = sweeper->getNextProduct();
            }   
             suM += sweeper->getPrice();
          }
          sum = suM;           


        } 
      // Calcular valor total dos produtos do carrinho
   float getTotalPrice()
        {
          
           Product* sweeper = firstProduct;
           float sum=0;

           while(sweeper->getNextProduct() != NULL)
                  sum += sweeper->getPrice();

          return sum;           

        } 
예제 #4
0
InvoiceLine InvoiceLine::fromProduct(const Product &p)
{
    InvoiceLine line;

    line.setName(p.getName());
    line.setDescription(p.getDescription());
    line.setPrice(p.getPrice());
    line.setQte(1);
    line.setOffPercentage(0);
    line.setBaseProductId(p.getId());

    return line;
}
 // Metodo que exibe na tela o resumo das compras feitas e o valor total e o desconto
     void  purchaseResume()

    {
        
      Product * sweeper = firstProduct;
      sum = 0;

   
      
            while (sweeper != NULL)
             {
        
              cout<<sweeper->getID()<<"  "<<sweeper->getName()<<"  "<<setprecision(2)<<fixed<<sweeper->getPrice()<<endl;
              cout<<endl;
              sum += sweeper->getPrice();
              sweeper = sweeper->getNextProduct();
             }
         


     cout<<endl;
     cout<<endl;

           if(fixedDiscount)
            {
             cout<<"Descontos:   -"<<setprecision(2)<<fixed<<discount<<endl;
             cout<<endl;
             sum -= discount;
             cout<<"Total:        "<<setprecision(2)<<fixed<<sum<<endl;
            }
          else
            {
            discount = (discount/100)*sum;
            cout<<"Descontosp:   -"<<setprecision(2)<<fixed<<discount<<endl;
            cout<<endl;
            sum -= discount;
            cout<<"Total:        "<<setprecision(2)<<fixed<<sum<<endl;
            }

 
                      

    }
예제 #6
0
파일: Store.cpp 프로젝트: KToshev/OOP
bool cmpByPrice(const Product& p1, const Product& p2)
{
    return p1.getPrice() > p2.getPrice();
}
예제 #7
0
double ProductOrder::getTotal() {
    return quantity * prod.getPrice();
}