// A program to calculate the number of tiles required by its customers
// Question 1
/* Name: Kalaivani A/P Subramaniam (A20EC0056)
   Name: Tan Ming Hui (A20EC0155)
   Date: 27 December 2020 */
   
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main()
{
	// Declaration
	int tilecode; 
	double tileprice,cost;
	float surfacewidth, surfacelength;
	int width, length, numtiles;
	
	cout << "Enter the tile's code => "; 
	cin>> tilecode;
	cout << "Enter the tile's price (RM) => "; 
	cin>> tileprice;
	cout<< "Enter the surface's width (in feet) => "; 
	cin >> surfacewidth;
	cout << "Enter the surface's length (in feet) => "; 
	cin >> surfacelength;	
	
	width= tilecode/100; // to identify tile width
    length= tilecode%100; //to identify tile length
    
    // to calculate  the number of tiles needed by the customer and the cost
	surfacewidth= surfacewidth*12;
	surfacelength= surfacelength*12;
	numtiles= ceil((surfacewidth*surfacelength)/(width*length));
	cost= numtiles*tileprice;
	
	// output
	cout << fixed << setprecision(2) << "\n";
	cout << "Customer's Receipt" << endl;
	cout << "=============" << endl;
	cout << "The tile to purchase:" << endl;
	cout << "Code :   " << tilecode << endl;
	cout << "Width :  " << width  << " inches" << endl;
	cout << "Length:  " << length << " inches" << endl;
	cout << "Price :  RM " << tileprice << "  per piece \n" << endl;
	cout << "The number of tiles required:  " << numtiles << "  pieces" << endl;
	cout << "The total cost:  RM " << cost << endl;
	
	return 0;
}


