Ask Question
19 September, 06:31

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. 19 September, 07:03
    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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers