Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

ARRAYS! C++! #include \"Room-solution.h\" //////////////////////// // // MODIFY

ID: 3824045 • Letter: A

Question

ARRAYS! C++!

#include "Room-solution.h"

////////////////////////

//

// MODIFY THIS FILE ACCORDING TO THE INSTRUCTIONS SHOWN BELOW IN CAPITAL LETTERS:

//

////////////////////////

int main()

{

// Create four room objects

Room lr(15, 12, "Living Room");

Room dr(12, 11, "Dining Room");

Room b1(13, 10, "Master Bedroom");

Room b2(10, 10, "Guest Bedroom");

// ADD A REST ROOM rr (size 6 by 7)

// ADD ANOTHER GUEST BEDROOM b3 WITH DEFAULT DIMENSIONS AND NAME

// ASSIGN TO b3 THE DIMENSIONS AND NAME OF b2

// CHANGE THE LENGTH AND WIDTH OF b3 TO 9 AND 8 RESPECTIVELY

int area; // area of the house

  

// Change the units of measurement to feet

Room::units = "feet";

// Print the number of rooms in the house

cout << "Number of rooms in the house = ";

cout << Room::numRooms << endl;

// Print the rooms in the house

cout << endl;

Room::printHeader();

lr.print();

cout << endl;

dr.print();

cout << endl;

b1.print();

cout << endl;

b2.print();

// INCLUDE THE ADDED ROOMS IN YOUR PRINT OUT

cout << endl << endl;

// INCLUDE THE AREA OF THE ADDED ROOMS IN THE CALCULATION OF THE TOTAL AREA

// Calculate and print the total area of the house

area = lr.getArea() + dr.getArea() + b1.getArea() + b2.getArea();

cout << "Total area of the house = " << area << " ";

cout << Room::units << endl;

  

system("pause");

return 0;

}

Explanation / Answer

Code :

#include "Room-solution.h"
////////////////////////
//
// MODIFY THIS FILE ACCORDING TO THE INSTRUCTIONS SHOWN BELOW IN CAPITAL LETTERS:
//
////////////////////////

int main()
{
// Create four room objects
Room lr(15, 12, "Living Room");
Room dr(12, 11, "Dining Room");
Room b1(13, 10, "Master Bedroom");
Room b2(10, 10, "Guest Bedroom");
// ADD A REST ROOM rr (size 6 by 7)
   Room rr(6,7,"Rest Room");
// ADD ANOTHER GUEST BEDROOM b3 WITH DEFAULT DIMENSIONS AND NAME
   Room b3();
// ASSIGN TO b3 THE DIMENSIONS AND NAME OF b2
   b3 = b2;
// CHANGE THE LENGTH AND WIDTH OF b3 TO 9 AND 8 RESPECTIVELY

int area; // area of the house
  
// Change the units of measurement to feet
Room::units = "feet";

// Print the number of rooms in the house
cout << "Number of rooms in the house = ";
cout << Room::numRooms << endl;

// Print the rooms in the house
cout << endl;
Room::printHeader();
lr.print();
cout << endl;
dr.print();
cout << endl;
b1.print();
cout << endl;
b2.print();
// INCLUDE THE ADDED ROOMS IN YOUR PRINT OUT
   cout << endl;
rr.print();
   cout << endl;
b3.print();
cout << endl << endl;

// INCLUDE THE AREA OF THE ADDED ROOMS IN THE CALCULATION OF THE TOTAL AREA

// Calculate and print the total area of the house
area = lr.getArea() + dr.getArea() + b1.getArea() + b2.getArea();
cout << "Total area of the house = " << area << " ";
cout << Room::units << endl;
  
system("pause");
return 0;
}