Latest Activity In Study Groups

Join Your Study Groups

VU Past Papers, MCQs and More

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.


complete solutions

I commented destruction part.

and please don't upload this .cpp other wise we both will ............. ,

ENJOYEEEEE

Views: 5091

Attachments:

Replies to This Discussion

mane ye program khud bnaya hai jo sulution dy rhy hain bht complex hai or eska solution bht he easy ha.

Output & program is here..

Attachments:

cs304 complete solution without errors may 2016

Attachments:

recName="";
recAddress ="";

senName="";
senAddress="";

};

Parcel::~Parcel()
{

//delete [] senAddress;
//delete [] senName;
//delete [] recName;
//delete [] recAddress;

};

int main(int argc, char * argv[]) {

int Id, weight, fee;
char senName[50],senAddress[100];
char recName[50], recAddress[100];

// create parcel calss object
Parcel parcel;

cout "Enter receipt no : "; cin >> Id;
parcel.ParcelId(Id);

cout "Enter Sender Name : "; cin.ignore(); cin.getline(senName, sizeof(senName)); parcel.senderName(senName); cout "Enter Sender Address : "; cin.ignore(-1); cin.getline(senAddress, sizeof(senAddress)); parcel.senderAddress(senAddress); cout "Enter Receiver Name : "; cin.ignore(-1); cin.getline(recName, sizeof(recName)); parcel.receiverName(recName); cout "Enter Receiver Address : "; cin.ignore(-1); cin.getline(recAddress, sizeof(recAddress)); parcel.receiverAddress(recAddress); cout "Enter weight (in grams) of a parcel : "; cin >> weight;
parcel.weight(weight);

cout "Enter Shipment Charges : "; cin >> fee;
parcel.fee(fee);

cout "\n\n Shipment Receipt"; cout "\n---------------------------"; cout "\n Receipt No. : " parcel.ParcelId(); cout "\n Sender Name : " parcel.senderName(); cout "\n Sender Address : " parcel.senderAdd(); cout "\n Receiver Name : " parcel.receiverName(); cout "\n Receiver Address : " parcel.receiverAdd(); cout "\n Parcel Weight (in grams) : " parcel.weight(); cout "\n Shipment Charges : " parcel.fee(); // Set parcel class data members system("pause");; }

#include <iostream>
using namespace std;
#include <string>


/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;

class Parcel
{

private:

// Parcel Details
int Id;
int pWeight, Fee;

// Sender 
char* senName;
char* senAddress;

// Reciver
char* recName;
char* recAddress;

// Let set/Assign values (Setter Functions)

public:

// Constructor

Parcel();

// Destructor

~Parcel();

// Set Parcel Details

void ParcelId (int ID)
{
Id = ID;
};

void weight (int wght)
{

pWeight = wght;

};
void fee (int fee)
{

Fee = fee;

};

// Set Sender Information

void senderName (char* sName)
{

senName = sName;

};

void senderAddress (char* sAddress)
{

senAddress = sAddress;

};

// Set Receiver Information

void receiverName (char* rName)
{
recName = rName;
};

void receiverAddress (char* rAddress)
{

recAddress = rAddress;

};


// Get Parcel Details 

int ParcelId()
{

return Id;
};

int weight()
{

return pWeight;

}
int fee()
{
return Fee;
};

char* senderName ()
{

return senName;

};

char* senderAdd()
{

return senAddress;
};

char* receiverName ()
{

return recName;

};

char* receiverAdd()
{

return recAddress;

}
};

// Constructor

Parcel:Tonguearcel()
{


Fee =0;
Id =0;
pWeight =0;

recName="";
recAddress ="";

senName="";
senAddress="";


};

Parcel::~Parcel()
{

//delete [] senAddress;
//delete [] senName;
//delete [] recName;
//delete [] recAddress;

};

int main(int argc, char * argv[]) {

int Id, weight, fee;
char senName[50],senAddress[100];
char recName[50], recAddress[100];

// create parcel calss object
Parcel parcel;


cout "Enter receipt no : ";
cin >> Id;
parcel.ParcelId(Id);


cout "Enter Sender Name : ";
cin.ignore();
cin.getline(senName, sizeof(senName));
parcel.senderName(senName);


cout "Enter Sender Address : ";
cin.ignore(-1);
cin.getline(senAddress, sizeof(senAddress));
parcel.senderAddress(senAddress);

cout "Enter Receiver Name : ";
cin.ignore(-1);
cin.getline(recName, sizeof(recName));
parcel.receiverName(recName);

cout "Enter Receiver Address : ";
cin.ignore(-1);
cin.getline(recAddress, sizeof(recAddress));
parcel.receiverAddress(recAddress);

cout "Enter weight (in grams) of a parcel : ";
cin >> weight;
parcel.weight(weight);

cout "Enter Shipment Charges : ";
cin >> fee;
parcel.fee(fee);

cout "\n\n Shipment Receipt";
cout "\n---------------------------";
cout "\n Receipt No. : " parcel.ParcelId();
cout "\n Sender Name : " parcel.senderName();
cout "\n Sender Address : " parcel.senderAdd();
cout "\n Receiver Name : " parcel.receiverName();
cout "\n Receiver Address : " parcel.receiverAdd();
cout "\n Parcel Weight (in grams) : " parcel.weight();
cout "\n Shipment Charges : " parcel.fee();

// Set parcel class data members






system("pause");;
}

RSS

Looking For Something? Search Below

VIP Member Badge & Others

How to Get This Badge at Your Profile DP

------------------------------------

Management: Admins ::: Moderators

Other Awards Badges List Moderators Group

Latest Activity

ልጠክል ጌዘልፕፕጎ liked Asrukh's video
1 minute ago
ልጠክል ጌዘልፕፕጎ liked Asrukh's video
2 minutes ago
Asrukh posted videos
27 minutes ago
+ ! ! Pagal Dewani ! ! + posted a video

VID-20210619-WA0011

27 minutes ago
Honey Chaudhary posted a video

Tun batye ga Ishaq hai kiya

27 minutes ago
Mani Siddiqui posted a blog post
34 minutes ago
Honey Chaudhary posted photos
35 minutes ago
Zohaib Hassan posted a photo
35 minutes ago

© 2021   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service