Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  Number 27
Language: C/C++
Code:
#include <iostream>

using namespace std;

int main() 
{     

     double     length_door;
     double     width_door;
     double     DoorTotal;
     double     length_window1;
     double     width_window1;
     double     WindowTotal1;
     double     length_window2;
     double     width_window2;
     double     WindowTotal2;
     double     length_bookshelf;
     double     width_bookshelf;
     double     BookshelfTotal;
     double     length_room;
     double     width_room;
     double     height_room;
     double     RoomTotal;
     double     totalGallons;
     double  area_paint;
     
     
     cout << "Program to input the perimeter and " 
          << "area of a rectangle." << endl;

     cout << "input the value of length of the door: ";
     cin >> length_door;
     cout << "input the value of width of the window: ";
     cin >> width_door;
     
     cout << "input the value of length of window 1: ";
     cin >> length_window1;
     cout << "input the value of width of window 1: ";
     cin >> width_window1;
     
     cout << "input the value of length of window 2: ";
     cin >> length_window2;
     cout << "input the value of width of window 2: ";
     cin >> width_window2;
     
     cout << "input the value of length of the bookshelf: ";
     cin >> length_bookshelf;
     cout << "input the value of width of the bookshelf: ";
     cin >> width_bookshelf;
     
     cout << "input the value of length of the room: ";
     cin >> length_room;
     cout << "input the value of width of the room: ";
     cin >> width_room;
     cout << "input the value of heigth of the room: ";
     cin >> height_room;
     
     cout << "input the area that can be painted in one gallon of paint ";
     cin >> area_paint;
     




     RoomTotal = ((length_room * height_room)*2) + ((width_room * height_room)*2);
     DoorTotal = length_door * width_door;
     WindowTotal1 = length_window1 * width_window1;
     WindowTotal2 = length_window2 * width_window2;
     BookshelfTotal = length_bookshelf * width_bookshelf;
     totalGallons = (RoomTotal - DoorTotal - WindowTotal1 - WindowTotal2  - BookshelfTotal)/ area_paint;
     

     
     cout << "The amount of paint needed to paint the room: " << totalGallons << endl;
     
     
     return 0;
     
}


          
Comments: