//Ava Huntington CS1A Chapter 4 Homework P. 220, #4
//
/*******************************************************************************
* CALCULATING RECTANGLE AREAS
* _____________________________________________________________________________
* This program will take the given length and width of two seperate rectangles
* and determine which is has a larger area of if they are equal in area.
*
* _____________________________________________________________________________
* INPUT
* length_1: Given length of rectangle 1
* length_2: Given length of retangle 2
* width_1: Given width of rectangle 1
* width_2: Given width of rectangle 2
*
*
* OUTPUT
* area_1: Area of rectangle 1 based on given inputs
* area_2: Area of rectangle 2 based on given inputs
******************************************************************************/
#include <iostream>
using namespace std;
int main()
{
float length_1; //INPUT: Given length of rectangle 1
float length_2; //INPUT: Given length of rectangle 2
float width_1; //INPUT: Given width of rectangle 1
float width_2; //INPUT: Given width of rectangle 2
float area_1; //OUTPUT: Area of rectangle 1 based on inputs
float area_2; //OUTPUT: Area of rectangle 2 based on inputs
//Prompt to get rectangle ones information
cout << "What is the length and width of the first rectangle? Enter the length"
" first then the width seperated by a space please.\n";
cin >> length_1;
cin >> width_1;
area_1 = length_1 * width_1;
//Prompt to get rectangle two information
cout << "What is the length and width of the second rectangle? Enter the length"
" first then the width seperated by a space please.\n";
cin >> length_2;
cin >> width_2;
area_2 = length_2 * width_2;
//Message if the first rectangles area is larger
if(area_1 > area_2)
{
cout << "Based on the data, rectangle one is larger than rectangle two."
<< endl;
}
else if(area_2 > area_1)
{
cout << "Based on the data, rectangle two is larger than rectangle one."
<< endl;
}
else if (area_2 == area_1)
cout << "Based on the data, the rectangles have equal areas." << endl;
return 0;
}