WRITE A PYTHON PROGRAM (RECTANCLE.PY) THAT HAS A CLASS NAMED RECTANGLE. RECTANGLE CLASS HAS TWO ATTRIBUTES, A LENGTH AND WIDTH, (BOTH INT). YOUR CLASS SHOULD HAVE THE FOLLOWING METHODS: (1)...


WRITE A PYTHON PROGRAM (RECTANCLE.PY) THAT HAS A CLASS NAMED RECTANGLE.<br>RECTANGLE CLASS HAS TWO ATTRIBUTES, A LENGTH AND WIDTH, (BOTH INT). YOUR<br>CLASS SHOULD HAVE THE FOLLOWING METHODS:<br>(1) _INIT._(SELF, LENCTH, WIDTH): THIS METHOD CALLED WHEN AN OBJECT IS<br>CREATED FROM THE CLASS AND IT ALLOWS THE CLASS TO INITIALIZE THE<br>ATTRIBUTES OF A CLASS.<br>(2) RECTANGLE.AREA(SELF): THIS METHOD WILL COMPUTE THE AREA OF A<br>RECTANGLE, THEN RETURN IT.<br>TO FIND THE AREA OF A RECTANGLE, MULTIPLY THE LENGTH BY THE WIDTH.<br>IN THE MAIN, YOU DO THE FOLLOWING:<br>A. WHEN YOU START THE PROGRAM, PRINT

Extracted text: WRITE A PYTHON PROGRAM (RECTANCLE.PY) THAT HAS A CLASS NAMED RECTANGLE. RECTANGLE CLASS HAS TWO ATTRIBUTES, A LENGTH AND WIDTH, (BOTH INT). YOUR CLASS SHOULD HAVE THE FOLLOWING METHODS: (1) _INIT._(SELF, LENCTH, WIDTH): THIS METHOD CALLED WHEN AN OBJECT IS CREATED FROM THE CLASS AND IT ALLOWS THE CLASS TO INITIALIZE THE ATTRIBUTES OF A CLASS. (2) RECTANGLE.AREA(SELF): THIS METHOD WILL COMPUTE THE AREA OF A RECTANGLE, THEN RETURN IT. TO FIND THE AREA OF A RECTANGLE, MULTIPLY THE LENGTH BY THE WIDTH. IN THE MAIN, YOU DO THE FOLLOWING: A. WHEN YOU START THE PROGRAM, PRINT "RECTANGLE CALCULATIONS USING CLASS" B. PROMPT THE USER FOR LENGTH AND WIDTH. C. CREATE ONE OBJECT OF THE RECTANGLE CLASS, REC1. D. PRINT THE AREA OF THE RECTANGLE BY CALLING RECTANGLE.AREA() HERE IS AN EXAMPLE RUN OF THE PROGRAM: RECTANGLE CALCULATIONS USING CLASS INPUT THE LENGTH: 5 INPUT THE WIDTH: 6 THE AREA OF THE RECTANGLE IS 30

Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here