Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please help with the following: All questions are related.....thank you. Write t

ID: 3867840 • Letter: P

Question

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 (

Explanation / Answer

Dear Student,

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


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

Kindly Check and Verify Thanks....!!!