Question: Here is the code from the last lab #include #include using namespace std; class Lab { private: string uId; string abbreviation; string uIdid; int aircraft;

 Here is the code from the last lab #include #include using

Here is the code from the last lab

#include #include

using namespace std;

class Lab

{

private:

string uId;

string abbreviation;

string uIdid;

int aircraft;

float weight;

string destination;

public:

Lab()

{

uId = "";

abbreviation = "";

uIdid = "";

aircraft = 0;

weight = 0;

destination = "";

}

Lab(string uid, string abb, string uidid, int ac, float w, string d)

{

uId = uid;

abbreviation = abb;

uIdid = uidid;

aircraft = ac;

weight = w;

destination = d;

weightMutator();

}

Lab(const Lab& l1)

{

uId = l1.uId;

abbreviation = l1.abbreviation;

uIdid = l1.uIdid;

aircraft = l1.aircraft;

weight = l1.weight;

destination = l1.destination;

}

// updating the weightMutator function as required and calling it in parameterized constructor once

void weightMutator()

{

string w;

cout

cin>>w;

transform(w.begin(), w.end(), w.begin(), ::tolower);

if(w == "kg" || w == "kilograms")

{

weight = kilotopound(*this);

}

}

void printData()

{

cout

cout

cout

cout

cout

cout

}

friend float kilotopound(Lab l1);

};

float kilotopound(Lab l1)

{

return l1.weight*2.2;

}

int main()

{

string uId;

string abbreviation;

string uIdid;

int aircraft;

float weight;

string destination;

cout

cout

cin>>uId;

cout

cin>>abbreviation;

cout

cin>>uIdid;

cout

cin>>aircraft;

cout

cin>>weight;

cout

cin>>destination;

Lab l(uId, abbreviation, uIdid, aircraft, weight, destination);

cout

l.printData();

Lab l2(l); cout

return 0; }

CIS 22B Lab 4 Itty Bitty Airfreight (IBA) 200 Points Topics: Overloaded operators Files Lab 4.1 Utilizing the code from Lab 3.2, add an overloaded operator == which will be used to compare two objects to see if they are equal. For our purposes, two objects are equal if their abbreviation and uldid are the same. You'll need to make your overloaded operator a friend of the Cargo class. Create a unit1 object and load it with this data: uld - Pallet abbreviation - PAG uldid PAG325971B aircraft - 737 weight - 3321 Kilograms destination -SEA Make a copy of unit1 called unit2 utilizing a copy constructor. Create a default unit3. Test with code like this in main: if (unit1 == unit2) cout

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!