Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
1.8 kB
2
Indexable
Never
#include<iostream>
using namespace std;
void input (float&,float&,float&);
float FindNet (float,float,float);
float calculateNet(float);
void output (float);



int main()
{
    float orange,manglo,durain,net;
    input(orange,manglo,durain);
    net=FindNet(orange,manglo,durain);
    output(net);
    
    
    while (check) {
        totalAmount=amount;
        
        float net=calculatNet();
        totalNet=net;
        
        totalDiscount=(amount-net);
        
        char yn;
        cout<<" RUN AGAIN ? Y/N "; cin>>yn;
        
        if (yn=='n')
            check==false;
    }
}



 
    
void input (float &o,float &m,float &d){
    
    cout<<"Orange ="; cin>>o;
    cout<<"Manglo ="; cin>>m;
    cout<<"Durain ="; cin>>d;
        
}

float FindNet(float o,float m,float d){
    
    float amount,discount,net,totalAmount,totalNet,totalDiscount;
    string yn,y,n;
    int c=0;
    bool check = true;
    
 
    
    do{
        o=50*o;
        m=55*m;
        d=130*d;
        
        amount=o+m+d;
        
        c=c+1;
        
        cout<<"Costomer "<<c<<endl;
        cout<<"Amount = "<<amount<<endl;

        
        if (amount>5000.0&& amount<20000.0){
            discount=(amount*5.0)/100.0;
            net= amount-discount;
            cout<<"Discount = "<<discount<<endl;
            cout<<"Net = "<<net<<endl;
            
        }
        else if  (amount>20000.0){
                discount=(amount*10.0)/100.0;
                net=amount-discount;
                cout<<"Discount = "<<discount<<endl;
                cout<<"Net = "<<net<<endl;
            
        }
        cout<<"Discount = "<<0<<endl;
        cout<<"Net = "<<amount<<endl;
        
    }
    
    return  net;
}
    
void output (float net){
    

    cout<<"to tal amount ="<<net<<endl;
}