Submitted by: Submitted by madmarty87
Views: 10
Words: 822
Pages: 4
Category: Science and Technology
Date Submitted: 07/05/2015 05:16 PM
// The following is code for a program that will display the total area of 4 given rooms within a house.
//It will also display to the user the total area in square feet of each room.
Test Case# | Input | Expected Output |
1 | B_room_1: Length=12 Width=10 Dining_room_2: Length=15.7 Width=17.4 Mstr_B_room_3: Length=16.1 Width=12.6 Bathroom_4: Length=7 Width=9 | 659.04 square feet |
2 | B_room_1: Length=11 Width=6 Dining_room_2: Length=12 Width=11.5 Mstr_B_room_3: Length=15.9 Width=8 Bathroom_4: Length=6.5 Width=5.5 | 366.95 square feet |
3 | B_room_1: Length=8 Width=7 Dining_room_2: Length=11.1 Width=9.6 Mstr_B_room_3: Length=16 Width=10.2 Bathroom_4: Length=5 Width=6.6 | 358.76 square feet |
//CODE FOR TEST CASE#1
#include <stdio.h>
// Declarations
int main (void)
{
// Variables for B_room 1
int B_room_1_L;
int B_room_1_W;
int B_room_1_Area;
// Variables for Dining_room 2
float Dining_room_2_L;
float Dining_room_2_W;
float Dining_room_2_Area;
// Variables for Mstr_B_Room 3
float Mstr_B_Room_3_L;
float Mstr_B_Room_3_W;
float Mstr_B_Room_3_Area;
// Variables for Bathroom_4
float Bathroom_4_L;
float Bathroom_4_W;
float Bathroom_4_Area;
// Variable for Total Area of all 4 rooms
float Total_Area;
//Measurements for B_room 1
B_room_1_L = 12;
B_room_1_W = 10;
B_room_1_Area = B_room_1_L * B_room_1_W;
//Measurements for Dining_room 2
Dining_room_2_L = 15.7;
Dining_room_2_W = 17.4;
Dining_room_2_Area = Dining_room_2_L * Dining_room_2_W;
//Measurements for Mstr_B_Room 3
Mstr_B_Room_3_L = 16.1;
Mstr_B_Room_3_W = 12.6;
Mstr_B_Room_3_Area = Mstr_B_Room_3_L * Mstr_B_Room_3_W;
//Measurements for Bathroom_4
Bathroom_4_L = 7;
Bathroom_4_W = 9;
Bathroom_4_Area = Bathroom_4_L * Bathroom_4_W;
//Total Area Measurement for all 3 Rooms
Total_Area = B_room_1_Area + Dining_room_2_Area + Mstr_B_Room_3_Area + Bathroom_4_Area;
/* What the user will see after...