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.

Dear students please discuss here about the solution of CS304 ( Object Oriented Programming ) assignment #2.

Views: 10861

Attachments:

Replies to This Discussion

class parcel  {
... .. ...
};
class normalparcel : public parcel {
... .. ...
};
class urgentparcel : public parcel {
.... .. ...
};

Thanks for the hint 

Assignment submitted.

Can you share your assignment here?

plz share ur assignment

dear ye to solution nahi ha?

Please complete solution dy dain...

o dear gusa kar liya asal baat ye ha ke ma job b karta hon aor time bohat kam hota ha.

if u have solution plz share

class Parcel{
protected:
int Id;
string senderName;
string senderAddress;
string receiverName;
string receiverAddress;
int weight;
int fee;
public:
Parcel(){
Id = 0;
senderName = "";
senderAddress = "";
receiverName = "";
receiverAddress = "";
weight = 0;
fee = 0;
}
void setId(int id){
Id = id;
}
int getId(){
return Id;
}

void setSenderName(string sname){
senderName = sname;
}
string getSenderName(){
return senderName;
}

void setSenderAddress(string saddress){
senderAddress = saddress;
}
string getSenderAddress(){
return senderAddress;
}

void setReceiverName(string rname){
receiverName = rname;
}
string getReceiverName(){
return receiverName;
}

void setReceiverAddress(string raddress){
receiverAddress = raddress;
}
string getReceiverAddress(){
return receiverAddress;
}

void setWeight(int w){
weight = w;
}
int getWeight(){
return weight;
}

void setFee(int f){
fee = f;
}
int getFee(){
return fee;
}

};

cs 304 assigment solution 2016

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

/* Assignment solution cs304 by Blu ( fb.com/92blu ) */

class Parcel{
protected: // changed from private to protected
int Id;
string senderName;
string senderAddress;
string receiverName;
string receiverAddress;
int weight;
int fee;
public:
Parcel(){
Id = 0;
senderName = "";
senderAddress = "";
receiverName = "";
receiverAddress = "";
weight = 0;
fee = 0;
}
void setId(int id){
Id = id;
}
int getId(){
return Id;
}

void setSenderName(string sname){
senderName = sname;
}
string getSenderName(){
return senderName;
}

void setSenderAddress(string saddress){
senderAddress = saddress;
}
string getSenderAddress(){
return senderAddress;
}

void setReceiverName(string rname){
receiverName = rname;
}
string getReceiverName(){
return receiverName;
}

void setReceiverAddress(string raddress){
receiverAddress = raddress;
}
string getReceiverAddress(){
return receiverAddress;
}

void setWeight(int w){
weight = w;
}
int getWeight(){
return weight;
}

void setFee(int f){
fee = f;
}
int getFee(){
return fee;
}

};

class normalParcel: public Parcel{
protected:
int chargesPerGram;
int basicCharges;
string shipmentType = "Normal";
public:
void setChargePerGram(int charges){
chargesPerGram = charges;
}
int getChargesPerGram(){
return chargesPerGram;
}
void setBasicCharges(int charges){
basicCharges = charges;
}
int getBasicCharges(){
return basicCharges;
}
string getShipmentType(){
return shipmentType;
}
};

class urgentParcel: public Parcel{
protected:
int chargesPerGram;
int basicCharges;
string shipmentType = "Urgent";
int additionalFee;
public:
void setChargePerGram(int charges){
chargesPerGram = charges;
}
int getChargesPerGram(){
return chargesPerGram;
}
void setBasicCharges(int charges){
basicCharges = charges;
}
int getBasicCharges(){
return basicCharges;
}
string getShipmentType(){
return shipmentType;
}
void setAdditionalFee(int fee){
additionalFee = fee;
}
int getAdditionalFee(){
return additionalFee;
}
};
int main(int argc, char** argv) {
cout"Assignment solution cs304 by Blu ( fb.com/92blu )"endlendl;
int selection;
while(1){
cout"Enter 1 for normal and 2 for urgent services.\n\nSelect type of service: ";
cin>>selection;
if(selection==1){
int id, weight, charges, fee, overWeightCharges;
string senderName, receiverName, senderAdd, receiverAdd, overWeight;
cout"Normal service selected.\n";
normalParcel p;
cout"Enter receipt number: ";
cin>>id;
p.setId(id);
cout"Enter sender name: ";
cin>>senderName;
p.setSenderName(senderName);
cout"Enter sender Address: ";
cin>>senderAdd;
p.setSenderAddress(senderAdd);
cout"Enter receiver name: ";
cin>>receiverName;
p.setReceiverName(receiverName);
cout"Enter receiver address: ";
cin>>receiverAdd;
p.setReceiverAddress(receiverAdd);
cout"Enter weight of parcel in grams: ";
cin>>weight;
p.setWeight(weight);
cout"Enter basic charges for the parcel: ";
cin>>charges;
p.setBasicCharges(charges);
cout"Enter fee per gram: ";
cin>>fee;
p.setFee(fee);
cout"\n\n\nShipment Receipt\n-------------------\n";
cout"Receipt No: "p.getId()endl;
cout"Sender Name: "p.getSenderName()endl;
cout"Sender Address: "p.getSenderAddress()endl;
cout"Receiver Name: "p.getReceiverName()endl;
cout"Receiver Address: "p.getReceiverAddress()endl;
cout"Parcel Weight: "p.getWeight()endl;
if(p.getWeight()>900){
overWeight = "Yes";
} else {
overWeight = "No";
}
cout"Over Weight: "overWeightendl;
cout"Basic Charges: "p.getBasicCharges()endl;
if(overWeight=="Yes"){
overWeightCharges = (p.getWeight() - 900) * p.getFee();
} else {
overWeightCharges = 0;
}
cout"Over Weight Charges: "overWeightChargesendl;
cout"Shipment Total Charges: "p.getBasicCharges() + overWeightChargesendl;
cout"Shipment type: "p.getShipmentType()endl;
return 0;
} else if(selection==2){
int id, weight, charges, fee, overWeightCharges, additionalfee;
string senderName, receiverName, senderAdd, receiverAdd, overWeight;
cout"Urgent service selected.\n";
urgentParcel p;
cout"Enter receipt number: ";
cin>>id;
p.setId(id);
cout"Enter sender name: ";
cin>>senderName;
p.setSenderName(senderName);
cout"Enter sender Address: ";
cin>>senderAdd;
p.setSenderAddress(senderAdd);
cout"Enter receiver name: ";
cin>>receiverName;
p.setReceiverName(receiverName);
cout"Enter receiver address: ";
cin>>receiverAdd;
p.setReceiverAddress(receiverAdd);
cout"Enter weight of parcel in grams: ";
cin>>weight;
p.setWeight(weight);
cout"Enter basic charges for the parcel: ";
cin>>charges;
p.setBasicCharges(charges);
cout"Enter fee per gram: ";
cin>>fee;
p.setFee(fee);
cout"Enter additional fee par gram: ";
cin>>additionalfee;
p.setAdditionalFee(additionalfee);
cout"\n\n\nShipment Receipt\n-------------------\n";
cout"Receipt No: "p.getId()endl;
cout"Sender Name: "p.getSenderName()endl;
cout"Sender Address: "p.getSenderAddress()endl;
cout"Receiver Name: "p.getReceiverName()endl;
cout"Receiver Address: "p.getReceiverAddress()endl;
cout"Parcel Weight: "p.getWeight()endl;
if(p.getWeight()>900){
overWeight = "Yes";
} else {
overWeight = "No";
}
cout"Over Weight: "overWeight"g"endl;
cout"Basic Charges: "p.getBasicCharges()+(p.getBasicCharges()/2)endl;
if(overWeight=="Yes"){
overWeightCharges = (p.getWeight() - 900) * (p.getFee()+p.getAdditionalFee());
} else {
overWeightCharges = 0;
}
cout"Over Weight Charges: "overWeightChargesendl;
cout"Shipment Total Charges: "p.getBasicCharges() + (p.getBasicCharges()/2) + overWeightChargesendl;
cout"Shipment type: "p.getShipmentType()endl;
return 0;
} else {
cout"Selected type of service is incorrect.\n\n";
}
}
return 0;
}

SK(MS-SE) jino nay samj kar karna huha na tu wu karin gay ... or jino nay nai karna wu kabi b nai karin gay ... ma kun jab assignment ati hai tu bar bar discussion ku active rakhta hun ..ius time abi kuhi dekh b nai raha huta hai discussion ku..but jinoo nay discussion start karni huti hai ap khud dekhtay hu gay k wu start kar dayta han discussion or ju points hutay han iun pa replies start hu jatay han ... 

SK(MS-SE) so ap apna kam jari rakhain ..or itni tension na lu jis nay kuch seekna huha tu wu ap khud dekh rahay hu gay k wu ap say questions etc kartay hun ga... or ju bas assignment solution solution lagahi huti ha..iun ku tu discussion ma solution provide b kar du tu wu phir b mang hi rahay hun gay k assignment solution  

RSS

Looking For Something? Search Below

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

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