Sie sind auf Seite 1von 8

AIR UNIVERSITY OOP LAB

DEPARTMENT OF ELECTRICAL ENGINEERING


OBJECT ORIENTED PROGRAMMING

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>

using namespace std;

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;

cout<<"Welcome To Ahsan's Stationary"<<endl;

cout<<"The Items Available: \n1. PaperCutters \n2. Pens \n3. PaperTape";

int set(){

int PaperCutters=150; int Pens=200; int PaperTape=350;

void get(){

cout<<"The Prices are: \nPaperCutters = "<<PaperCutters<<endl;


AIR UNIVERSITY OOP LAB

cout<<"Pens = "<<Pens<<endl;

cout<<"PaperTape = "<<PaperTape<<endl;

void inputVal1(){

cout<<"Enter the Product You wanna Buy: ";cin>>partdescription;cout<<endl;

cout<<"Enter the Number of Product You wanna Buy: ";

cin>>PaperTape;cout<<endl;

if(partdescription =="PaperCutters"||partdescription=="PaperCutters"||partdescription=="1")

int total1=0;

total1=(PaperCutters*PaperTape);

cout<<"Your Balance for current item : "<<total1;cout<<endl;

cout<<"Enter the Product You wanna Buy: ";cin>>partdescription;cout<<endl;

cout<<"Enter the Number of Product You wanna Buy: ";

cin>>PaperTape;cout<<endl;

if(partdescription =="Pens"||partdescription=="Pens"||partdescription=="2")

int total2=0;

total2=(Pens*PaperTape);
AIR UNIVERSITY OOP LAB

cout<<"Your Balance for current item : "<<total2;cout<<endl;

cout<<"Enter the Product You wanna Buy: ";cin>>partdescription;cout<<endl;

cout<<"Enter the Number of Product You wanna Buy: ";

cin>>PaperTape;cout<<endl;

if(partdescription =="PaperTape"||partdescription=="Paper Tape"||partdescription=="3")

int total3=0;

total3=(PaperTape*PaperTape);

cout<<"Your Balance for current item : "<<total3;cout<<endl<<endl;

int total =0;

total =total1+total2+total3;

cout<<"Your Total Balance is ="<<total;

};

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…!

Das könnte Ihnen auch gefallen