Ask 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 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).

+3
Answers (1)
  1. 26 January, 14:21
    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?
Find 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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers