Question & Answer: Please help with the following: All questions are related…..thank you……

Please help with the following: All questions are related…..thank you.
Write the class specification of a class Phone containing: 1. A data member named model of type string (private). 2. A data member named partNumber of type string (private). 3. A data member named retailPrice of type double (private). 4. A default constructor that intializes model and partNumber to empty strings and retailPrice to O. 5. getter (accessor) functions that return the value of each of the data members 6. setter (mutator) functions to set each of the data members 7. Overloaded stream insertion operator (<s) that output the data members to an output stream (format: model, part number, retail price) 8. Overloaded stream extraction operator (») that reads the data members from an input stream (format: model, part number, retail price) Note that youre NOT asked to implement any member functions of the class. Write only the class specification.
media%2Fcfd%2Fcfd6556a-5631-40ea-bc65-03
media%2F8dd%2F8ddc914b-604c-42f3-abe3-21
media%2F3af%2F3af1533e-fd15-4eda-969d-30

Show transcribed image textWrite the class specification of a class Phone containing: 1. A data member named model of type string (private). 2. A data member named partNumber of type string (private). 3. A data member named retailPrice of type double (private). 4. A default constructor that intializes model and partNumber to empty strings and retailPrice to O. 5. getter (accessor) functions that return the value of each of the data members 6. setter (mutator) functions to set each of the data members 7. Overloaded stream insertion operator (

Expert Answer

 

below i have written the class specification as per the requirement.

—————————————————————————————————————————————-

Program:

—————————————————————————————————————————————-

//header file declaration

#include<iostream>

#include<stdlib.h>

//Namespace declaration

using namespace std;

//Phone class declration

class Phone

{

//private member variable

private:

string model, partNumber;

double retailPrice;

public:

//constructor

Phone()

{

//member variable initialize to default values

model = ” “;

partNumber = ” “;

retailPrice = 0;

}

//getter functions

string getmodel()

{

return model;

}

string getpartNUmber()

{

return partNumber;

}

double getretailPrice()

{

return retailPrice;

}

//setter functions

void setModel(string M)

{

model = M;

}

void setpartNumber(string P)

{

partNumber = P;

}

void setretailPrice(double RP)

{

retailPrice = RP;

}

cout<<“Model = “<<model<<” Part-NUmber = “<<partNumber<<” RetailPrice = “<<retailPrice<<endl;

cin>>model<<partNumber<<retailPrice;

};

//derived class declaration

class CameraPhone : public Phone

{

//private member variable declaration

private:

int imageSize, memorySize;

public:

//a parametarized constructor declration
CameraPhone(int x, int y)

{

imageSize = x;

memorySize = y;

}

//memebr function declration

int numPictures(int P)

{

return P;

}

};

//start of main function

int main()

{

//a variable declration

double price;

//CameraPhone class object declration

CameraPhone myPhone(2, 64);

//call to functions

myPhone.setModel(“Droid Maxx2”);

myPhone.setpartNumber(“224455”);

//ask for user input

cout<<“Enter Retail-Price: “;

cin>>price;

myPhone.setretailPrice(price);

return 0;

}//end of the main function

—————————————————————————————————————————————–

Still stressed from student homework?
Get quality assistance from academic writers!