Write the definition of a class FRAME in C++ with following description:

Private Members:
-FID // data member of integer type
-Height // data member of float type
-Width // data member of float type
-Amount // data member of float type
-GetAmount() // Member function to calculate and assign asmount as 10*Height*Width

Public Members:
-GetDetail() // A function to enter value of FID, Height, Width and 
// call function GetAmount().
-DispDetail() //A function to display the value of all data members.

===============================================
Solution:
===============================================
class FRAME
{
int FID,
float Height, Width, Amount;
void GetAmount()
{
Amount=10*Height*Width;
}
public:
void GetDetail()
{
cout<<"Enter the Frame ID    : ";
cin>>FID;
cout<<"Enter Height of Frame : ";
cin>>Height;
cout<<"Enter Width of Frame  : ";
cin>>Width;
GetAmount();
}
void DispDetail()
{
cout<<"..........FRAME DETAILS..........\n";
cout<<"Frame ID        : "<<FID<<endl;
cout<<"Height of Frame : "<<Height<<endl;
cout<<"Width of Frame  : "<<Width<<endl;
cout<<"Amount of Frame : "<<Amount<<endl;
}
};


No comments

Post your comments

Powered by Blogger.