Click to like/follow us on:
Write an algorithm that will request for the length and width of a room together with the length and width of a carpet/tile. The algorithm will calculate and display the number of carpets/tiles that will be used to cover the room.

Premise:
Here there are some questions embedded the question (example four) above. I am sure that you noticed that the algorithm will request for the length and the width both the room and the carpet. Now using the knowledge you have acquired when you were in college/high school, if am not mistaking, you will abide with me that I will calculate the area of both the room and the carpet first, this (the calculated areas) is what will enable me to calculate the number of the  carpets that will be needed to cover the room. So as you can see the question never says we should calculate the area of the room and the carpet, this means that  basic mathematical knowledge is required in basic algorithm development or programming and rigorous math knowledge in rigorous algorithm development or programming.

Solution:
Major Steps
1. Request Data
2. Calculate the number of carpets
3. Display the number of carpets
Stepwise Refinement
1. Request Data
    1.1 Request room length
    1.2 Request room width
    1.3 Request carpet length
    1.4 Request carpet width
2. Calculate the number of carpets
    2.1 RoomArea = RoomLength * RoomWidth
    2.2 CarpetArea = CarpetLength * CarpetWidth
    2.3 Number of Carpets = RoomArea/CarpetArea
3. Display the number of Carpets
Test:
To test the algorithm, make use of a known length and width of any room and the area of the carpet used in that same room. Determine the actual number of the carpet in the room check if the algorithm will give same number of carpets.

SHARE THIS POST WITH YOUR FRIENDS...::

0 comments:

Leave a Reply

All Posts

Access all posts here!

Categories

Unordered List

Sample Text

Lists of Jobs in the United States

List of Courses & Outlines For UNN Students

Popular Posts

Like us on Facebook

Recent Posts

    Text Widget