Ask Question
24 January, 19:36

Codehs 7.4.6: Gymnastics Mats

Calculate how many mats will be needed to fill a room given the dimensions of each mat and the dimensions of the room.

In the start function, ask the user for the dimensions of the mat. Calculate the area and return that value to the start function. Print the area of the mat to the user. Then ask the user for the dimensions of the room and calculate how many mats will be needed to fill the room. Print this value to the user.

You will need to use a function named calculateArea in your program. This function should take two parameters (length and width).

+1
Answers (1)
  1. 24 January, 20:36
    0
    A code in C+ + follows:

    Explanation:

    #include

    using namespace std;

    int calculate_area (int width, int length)

    {

    int area;

    area=width*length;

    return area;

    }

    int main ()

    {

    int a, b, ar, c, d, ar1, n;

    cout<<"/nEnter length of room:";

    cin>>a;

    cout<<"/nEnter width of room:";

    cin>>b;

    ar=calculate_area (a, b);

    cout<<"/nArea of room:"<
    cout<<"/nEnter length of mat:";

    cin>>c;

    cout<<"/nEnter width of mat:";

    cin>>d;

    ar1=calculate_area (c, d);

    n=ar/ar1;

    cout<<"/nNumber of mats required are:"<
    return 0;

    }
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Codehs 7.4.6: Gymnastics Mats Calculate how many mats will be needed to fill a room given the dimensions of each mat and the dimensions of ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers