Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is c++ program. A carpet company has an extra unique flair because they pride themselves on conscientious covering of any room using only carpet

This is c++ program. A carpet company has an extra unique flair because they pride themselves on conscientious covering of any room using only carpet cut in the shape of squares. Write a program to help the company cover a room with the fewest pieces of carpet needed. The carpet squares all measure an integer number of feet on each edge, and only accepts jobs for rooms with both width (W) and length (L) in integer number of feet. Obviously if a room is perfectly square, the company can finish the job with a single piece of carpet, and the maximum number of carpet squares that would ever be needed is L x W squares, each 1-foot on a side. Input from the keyboard the width and length of the room as integers up to a maximum size of 25. Output to the screen on the first line, "N squares can cover W x L " (replacing N, W, and L with their respective values). On the next line print the sizes of the squares in increasing order, separated by spaces. Finally, output a blank line and then print a map of the room, using a different capital letter (A, B, ) for each square of carpet used. The map may not match the sample output, but the minimum number of squares must. Error check inputs. For C++ use the string class. Refer to the sample output below.

Enter the carpet width and length: 11 10

6 squares can cover 11x10.

2 2 4 5 5 6

AAAAAABBBBB

AAAAAABBBBB

AAAAAABBBBB

AAAAAABBBBB

AAAAAABBBBB

AAAAAACCCCC

DDDDEECCCCC

DDDDEECCCCC

DDDDFFCCCCC

DDDDFFCCCCC

Name the program: CarpetCoverXX.java or CarpetCoverXX.cpp, where XX are your initials.

This is all the question include the sample run.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Fundamentals Study Guide

Authors: Dr. Sergio Pisano

1st Edition

B09K1WW84J, 979-8985115307

More Books

Students also viewed these Databases questions

Question

How is a multiple reimbursement scheme committed?

Answered: 1 week ago

Question

Simplify. (x + h) - x h

Answered: 1 week ago

Question

l Discuss three types of individual incentives.

Answered: 1 week ago

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago