Make a class for drawing a car. A two-dimensional car can be drawn by putting together a rectangle, circles, arcs, and lines. Make a class in the Shape hierarchy from Chapter 9.4 for drawing a car,...


Make a class for drawing a car. A two-dimensional car can be drawn by putting together a rectangle, circles, arcs, and lines. Make a class in the Shape hierarchy from Chapter 9.4 for drawing a car, following the same principle as in Exercise 9.20. The constructor takes a length L of the car and the coordinates of a point p. The various shapes that build up the car must have dimensions relative to L and placements relative to p. Draw a small car and a large car in the same figure. Name of program file: draw_car.py.


Exercise 9.20


Make a class for drawing a person. A very simple sketch of a human being can be made of a circle for the head, two lines for the arms, one vertical line or a rectangle for the torso, and two lines for the legs. Make a class in the Shape hierarchy from Chapter 9.4 for drawing such a simple sketch of a person. Build the figure from Line and Circle instances. Supply the following arguments to the constructor: the center point of the head and the radius R of the head. Let the arms and the torso be of length 4R, and the legs of length 6R. The angle between the legs can be fixed (say 30 degrees), while the angle of the arms relative to the torso can be an argument to the constructor with a suitable default value. Name of program file: draw_person.py


Nov 14, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here