#include <iostream>
#include <math.h>
using namespace std;
class Building
{
private:
int length, width, ratePerSqFeet;
public:
void initializeData(int l, int w, int r)
{
length=l;
width=w;
ratePerSqFeet=r;
}
void getLength(int length, int width, int ratePerSqFeet)
{
cout<<"Length : "<<length<<endl;
}
void getWidth()
{
cout<<"Width : "<<width<<endl;
}
void getRatePerSqFeet()
{
cout<<"Rate Per SqFt : "<<ratePerSqFeet<<endl;
}
void calculateCost()
{
int z;
z=length*width*ratePerSqFeet;
cout<<"Cost of the Building : "<<z<<endl;
}
void determineSuitability()
{
if(length==70)
{
if(abs(length-width)>10)
cout<<"Suitability : Suitable";
}
else if(length==width)
cout<<"Suitability : Suitable";
else if(abs(length-width)<10)
{
cout<<"Suitability : Suitable"<<endl;
}
else
{
cout<<"Suitability : Not Suitable"<<endl;
}
}
}objname;
int main()
{
int l, w, r;
cin>>l>>w>>r;
objname.initializeData(l, w, r);
objname.getLength(l, w, r);
objname.getWidth();
objname.getRatePerSqFeet();
objname.calculateCost();
objname.determineSuitability();
return 0;
}
#include <math.h>
using namespace std;
class Building
{
private:
int length, width, ratePerSqFeet;
public:
void initializeData(int l, int w, int r)
{
length=l;
width=w;
ratePerSqFeet=r;
}
void getLength(int length, int width, int ratePerSqFeet)
{
cout<<"Length : "<<length<<endl;
}
void getWidth()
{
cout<<"Width : "<<width<<endl;
}
void getRatePerSqFeet()
{
cout<<"Rate Per SqFt : "<<ratePerSqFeet<<endl;
}
void calculateCost()
{
int z;
z=length*width*ratePerSqFeet;
cout<<"Cost of the Building : "<<z<<endl;
}
void determineSuitability()
{
if(length==70)
{
if(abs(length-width)>10)
cout<<"Suitability : Suitable";
}
else if(length==width)
cout<<"Suitability : Suitable";
else if(abs(length-width)<10)
{
cout<<"Suitability : Suitable"<<endl;
}
else
{
cout<<"Suitability : Not Suitable"<<endl;
}
}
}objname;
int main()
{
int l, w, r;
cin>>l>>w>>r;
objname.initializeData(l, w, r);
objname.getLength(l, w, r);
objname.getWidth();
objname.getRatePerSqFeet();
objname.calculateCost();
objname.determineSuitability();
return 0;
}
this program is showing only 88% in elab
ReplyDeletechange (length==60)
Deleteyou gett 100% result
thankx bro.i was looking for this solution. Again thankyou very much bro
Deletethe following program evaluates to 88%
ReplyDeletechange (length==60)
Deleteyou gett 100% result
test case 6 failed
ReplyDeletechange (length==60)
Deleteyou gett 100% result
This comment has been removed by the author.
ReplyDelete//This code is working
ReplyDelete#include
using namespace std;
class Building
{
private:
int length;
int width;
int ratePerSqFeet;
public:
void initializeData(int a, int b, int c)
{
length = a;
width = b;
ratePerSqFeet = c;
}
public:
int getLength()
{
return length;
}
public:
int getWidth()
{
return width;
}
public:
int getRatePerSqFeet()
{
return ratePerSqFeet;
}
public:
void calculateCost()
{
int cost;
cost = length * width * ratePerSqFeet;
cout << "Cost of the Building : " << cost << endl;
}
public:
void determineSuitability()
{
cout << "Suitability : ";
if (abs(length - width) <= 10)
cout << "Suitable";
else
cout << "Not Suitable";
}
};
int main()
{
Building objname;
int a, b, c, l, w, r;
cin >> a >> b >> c;
objname.initializeData(a, b, c);
l = objname.getLength();
w = objname.getWidth();
r = objname.getRatePerSqFeet();
cout << "Length : " << l << endl
<< "Width : " << w << endl
<< "Rate Per SqFt : " << r << endl;
objname.calculateCost();
objname.determineSuitability();
return 0;
}
you forgot the libraries dude
Delete#include
ReplyDeleteusing namespace std;
class Building
{
private:
int length,width,ratePerSqFeet;
public:
void initializeData(int i,int j,int k)
{
length=i;
width=j;
ratePerSqFeet=k;
}
int getLength()
{
cout<<"Length : "<=-10)
{
cout<<"Suitability : Suitable";
}
else
{
cout<<"Suitability : Not Suitable";
}
}
};
int main() {
Building objname;
int i,j,k;
cin>>i>>j>>k;
objname.initializeData(i,j,k);
objname.getLength();
objname.getWidth();
objname.getRatePerSqFeet();
objname.calculateCost();
objname.determineSuitability();
return 0;
}