House Area Calculator

 

#include <bits/stdc++.h>
using namespace std ;

float converter(float n){
int intpart = (int)n;
float decpart = (n - intpart)*10 ;
decpart = decpart/12 ;
float sum = intpart + decpart ;
return (float)sum ;
}

int main(){
cout << "__________House Area Calculator_________ " << '\n';
cout << "Note :- Only give values in Feet & Inches" << '\n';
cout << "Some Examples on how to enter values" << '\n';
cout << "1) 5.6 --Here 5 is in Feet's and 6 is in inches" << '\n' ;
float kitchen_length,feet_kitchen_length;
float kitchen_width,feet_kitchen_width ;
float hall_length, feet_hall_length;
float hall_width, feet_hall_width;
float bedroom1_length,feet_bedroom1_length;
float bedroom1_width,feet_bedroom1_width;
float bedroom2_length,feet_bedroom2_length;
float bedroom2_width,feet_bedroom2_width;
float toilet1_length,feet_toilet1_length;
float toilet1_width,feet_toilet1_width;
float toilet2_length,feet_toilet2_length;
float toilet2_width,feet_toilet2_width;
float balcony1_length,feet_balcony1_length;
float balcony1_width,feet_balcony1_width;
float balcony2_length,feet_balcony2_length;
float balcony2_width,feet_balcony2_width;
cout << ".....Enter area of each room given below......" << '\n';
cout << '\n';
cout << "HALL Length : " ;
cin >> hall_length ;
cout << " Width : " ;
cin >> hall_width ;
cout << '\n';
cout << "Kitchen Length : " ;
cin >> kitchen_length ;
cout << " Width : " ;
cin >> kitchen_width ;
cout << '\n';
cout << "Bedroom 1 Length : " ;
cin >> bedroom1_length ;
cout << " Width : " ;
cin >> bedroom1_width ;
cout << '\n';
cout << "Bedroom 2 Length : " ;
cin >> bedroom2_length ;
cout << " Width : " ;
cin >> bedroom2_width ;
cout << '\n';
cout << "Toilet 1 Length : " ;
cin >> toilet1_length ;
cout << " Width : " ;
cin >> toilet1_width ;
cout << '\n';
cout << "Toilet 2 Length : " ;
cin >> toilet2_length ;
cout << " Width : " ;
cin >> toilet2_width ;
cout << '\n';
cout << "Balcony 1 Length : " ;
cin >> balcony1_length ;
cout << " Width : " ;
cin >> balcony1_width ;
cout << '\n';
cout << "Balcony 2 Length : " ;
cin >> balcony2_length ;
cout << " Width : " ;
cin >> balcony2_width ;
cout << '\n';
feet_hall_length = converter(hall_length);
feet_hall_width = converter(hall_width);
feet_kitchen_length = converter(kitchen_length);
feet_kitchen_width = converter(kitchen_width);
feet_bedroom1_length = converter(bedroom1_length);
feet_bedroom1_width = converter(bedroom1_width);
feet_bedroom2_length = converter(bedroom2_length);
feet_bedroom2_width = converter(bedroom2_width);
feet_toilet1_length = converter(toilet1_length);
feet_toilet1_width = converter(toilet1_width);
feet_toilet2_length = converter(toilet2_length);
feet_toilet2_width = converter(toilet2_width);
feet_balcony1_length = converter(balcony1_length);
feet_balcony1_width = converter(balcony1_width);
feet_balcony2_length = converter(balcony2_length);
feet_balcony2_width = converter(balcony2_width);

float hall_area = feet_hall_length*feet_hall_width ;
float kitchen_area = feet_kitchen_length*feet_kitchen_width ;
float bedroom1_area = feet_bedroom1_length*feet_bedroom1_width ;
float bedroom2_area = feet_bedroom2_length*feet_bedroom2_width ;
float toilet1_area = feet_toilet1_length*feet_toilet1_width ;
float toilet2_area = feet_toilet2_length*feet_toilet2_width ;
float balcony1_area = feet_balcony1_length*feet_balcony1_width ;
float balcony2_area = feet_balcony2_length*feet_balcony2_width ;

float carpet_area = hall_area + kitchen_area + bedroom1_area + bedroom2_area + toilet1_area + toilet2_area ;
float total_area = carpet_area + balcony1_area + balcony2_area ;

cout << "CARPET AREA (Excludes Balconies) : " << carpet_area << '\n';
cout << "TOTAL AREA : " << total_area << '\n';
return 0;
}

Comments

Popular posts from this blog

CodeChef::CSUB

How Recursion Works?

CodeChef::TREE2