Athithya Karihalan and his Hobby

#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;
}

11 comments:

  1. this program is showing only 88% in elab

    ReplyDelete
    Replies
    1. change (length==60)
      you gett 100% result

      Delete
    2. thankx bro.i was looking for this solution. Again thankyou very much bro

      Delete
  2. the following program evaluates to 88%

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. //This code is working

    #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;
    }

    ReplyDelete
  5. #include
    using 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;
    }

    ReplyDelete