Skip to content
← Back to Community
I need HELP
Profile icon
YusiruMadurappe

92289092_554236185196597_7379211512012865536_n

Problem: Roll carpet comes in rolls 3.66 meters wide. Carpet is paid for by the total number
of whole metres that need to be cut from the roll. It may be laid in a rectangular room
lengthways or widthways. Either way there might be some wastage. The length of a room is
always its longer dimension and its width is always its shorter dimension.

Write a program that repeatedly asks the user for room dimensions until either dimension
entered is zero or less. For each room print the length and width (to the nearest millimetre),
and the total length of carpet required in whole metres, both lengthwise and widthwise.

Voters
Profile icon
YusiruMadurappe
Comments
hotnewtop
Profile icon
DouggieMonfils

This is a simple problem to tackle. Always buy carpets that are 20-30 cm smaller than the room. It's not as obnoxious a solution as it appears. Simply install furniture in areas where there is a bare floor. It will have a simple appearance, yet it will be intriguing. My words will be confirmed by the guys from https://www.rugsdoneright.com/collections/manufacturer-kalaty-rug-co . And tens of thousands of people seek their assistance on a daily basis. They've sold more rugs in a year than I have in a year, and I trust their professional judgment. You don't have to hunt for a solution to all computer difficulties; all you have to do is turn on your thinking on occasion.

Profile icon
Tarnished

We are now in the process of buying the last stuff for our new apartment, and the most significant challenge now are the carpets. My husband doesn't admire rugs and is definitely in the opinion not to buy them. But for me, I am a lover of beautiful and unique carpets. I even found a fantastic store, https://www.rugsdoneright.com/collections/shape-stair-runner, with many options regarding carpets, and all are extraordinary. They are special, and their design is eye-pleasing. I would definitely convince him to purchase at least two.

Profile icon
SixBeeps

Which part is tripping you up?

Profile icon
YusiruMadurappe

https://repl.it/@YusiruMadurappe/BulkyWhoppingLoopfission @SixBeeps

I did up to this but i don't know how to get the total lengthways and widthways.

Profile icon
SixBeeps

@YusiruMadurappe Ah, you're doing a floor division. Although it might be easy to use, this is not the time for it. Instead, you should round it up, not down.

Profile icon
YusiruMadurappe

I didn't understand what you said.
@SixBeeps

Profile icon
SixBeeps

@YusiruMadurappe Well, it's not there anymore. You used the // operator, which does division, then rounds the result down.

Profile icon
YusiruMadurappe

https://repl.it/@YusiruMadurappe/BulkyWhoppingLoopfission

Can know please tell me what should I do next.
@SixBeeps

Profile icon
SixBeeps

@YusiruMadurappe I'm allowed to answer specific questions, not tell you how to do an assignment.