233k views
2 votes
You will create two classes, one for a box and one for a triangle. Each of the figures, the box and the triangle, will have an offset telling how far they are indented from the edge of the screen. Each figure will also have a size, although the size will be determined differently for a box and a triangle. For a box, the size is given as the width and the height, expressed in the number of characters. Because characters are taller than they are wide, a box will look taller than you might expect when it is written on the screen. For a triangle, the size will be given by its base. The triangle will point up, and the base will be at the bottom. The slope of a side of the triangle is limited to what you get by indenting one character per line. So once the base is chose, you have no choice regarding what the sides of the triangle will be. We also assume that the base size of a triangle must be odd. The following shows a sample of a 5-by-5 box and a triangle with base of size 15. Assuming that the offset 10. The

1 Answer

3 votes

I believe it should be

User Igor Flakiewicz
by
6.8k points