Beruflich Dokumente
Kultur Dokumente
ASSIGNMENT:
LAB TASK 3
PRESENTED TO:
AHMED ALI
AIR UNIVERSITY ISLAMABAD
PRESENTED BY:
MUHAMMAD AHSAN MURTAZA
F18-3B-180552
BEE(POWER)
-------------------------------------------------------------
AIR UNIVERSITY OOP LAB
Task no1:
Provide a set and a get function for each data member. In addition, provide
a member function named getInvoiceAmount that calculates the invoice
amount (i.e., multiplies the quantity by the price per item), then returns the
amount as an int value. If the quantity is not positive, it should be set to 0. If
the price per item is not positive, it should be set to 0. Write a test program
that demonstrates class Invoice’s capabilities.
Code:
#include<iostream>
class invoice{
private:
int price;
int PaperCutters;
int Pens;
int Papertape;
public:
string partnumber;
string partdescription;
int PaperTape;
int total;
int total1;
int total2;
int total3;
AIR UNIVERSITY OOP LAB
invoice(){
partnumber ="XXXXX";
partdescription ="XXXXX";
PaperTape = 0;
price = 0;
PaperCutters=150;
Pens=10;
PaperTape=50;
total=0;
void intro(){
cout<<"HOLA ";cout<<endl<<endl;
int set(){
void get(){
cout<<"Pens = "<<Pens<<endl;
cout<<"PaperTape = "<<PaperTape<<endl;
void inputVal1(){
cin>>PaperTape;cout<<endl;
if(partdescription =="PaperCutters"||partdescription=="PaperCutters"||partdescription=="1")
int total1=0;
total1=(PaperCutters*PaperTape);
cin>>PaperTape;cout<<endl;
if(partdescription =="Pens"||partdescription=="Pens"||partdescription=="2")
int total2=0;
total2=(Pens*PaperTape);
AIR UNIVERSITY OOP LAB
cin>>PaperTape;cout<<endl;
int total3=0;
total3=(PaperTape*PaperTape);
total =total1+total2+total3;
};
int main(){
AIR UNIVERSITY OOP LAB
invoice i;
i.intro();
cout<<endl;
i.set();
cout<<endl;
i.get();
cout<<endl;
i.inputVal1();
cout<<endl;
}
AIR UNIVERSITY OOP LAB
RESULT:
AIR UNIVERSITY OOP LAB
------------------------------------------------------------------------------------
THE
END…!