//HAM JING YI A19EC0048
//Program 8.2
//Question 2
#include<iostream>
using namespace std;

class Rectangle
{
	protected:
		double width;
		double length;
		double calculateArea();
	
	public:
		Rectangle(double,double);
		void display();
};

Rectangle::Rectangle(double width,double length)
{
	this->width=width;   //(a)
	this->length=length; //(a)
}

void Rectangle::display()
{
	cout<<width<<endl;
	cout<<length<<endl;
}

double Rectangle::calculateArea()
{
	return width*length;
}


class Square: public Rectangle //(b)
{
	private:
		double height;
	
	public:
		Square(double,double,double); //(c)
		double calculateVolume();
		void display();
};

Square::Square(double height,double width, double length):Rectangle(width,length) //(d)
{
	this->height=height;
	this->width=width;
	this->length=length;
}

double Square::calculateVolume()
{
	return calculateArea()*height; //(e)
}

void Square::display()
{
	Rectangle::display(); //(f)
	cout<<height;
	cout<<calculateVolume();
}

int main()
{
	Square squarebox(15,10,10); //(g)
	cout<<"Volume of squarebox : "<<squarebox.calculateVolume()<<endl; //(h)
	squarebox.display(); //(i)
	
	return 0;
}
