Question: 10:14 LTE T Moodle CE Computing Lab Exercise Circle Inheritance hasbro privatnimo piano thend guter methodnoty that the theme states that retter 20 the attend
10:14 LTE T Moodle CE Computing Lab Exercise Circle Inheritance hasbro privatnimo piano thend guter methodnoty that the theme states that retter 20 the attend the methodnocom de woede en . Pretpresterande Create it whe 1. Inheritance: Create a class named Shape, which contains attributes and methods common to all shapes, then it creates two child classes Rectangle and Circle which contains attributes and methods specific to them only A Class Shaper It has two private instance variables s_name (of type String ands_colorlof type String . It has a constructor that initializess_name and s_color to the value specified in the parameter. . It has setters and getters methods. . It has one method __att_that returns the string representation of the name and color B. Class Rectangle: . It has two instance variables length and width (both of type double) It has a constructor that calls the super class constructor to initialize the shape name and color Also, it initializes the length and with to the values specified in the parameters . It has setter and getter methods using property function It has two methods a method pet_ares that returns the area of the rectangle and a method get per ineter that returns the perimeter of the rectangle . It has ane method _str_that overrides the superclass version and returns a sering representation of the shape name, color, area and the perimeter Eng. Bauma Allahad 26 Cpr 201 Computer Engineering Department C Class Circle: It has one instance variable radius for type double) It has a constructor that calls the super class constructor to initialize the shape name and color. Also, it initializes the radius to the value specified in the parameter . It has setter and getter methods using property function It has two methods: a method get area that returns the area of the cide and a method get_perimeter that returns the perimeter of the circle . It has one method __str_that overrides the superclass version and returns a string representation of the shape name, color area and the perimeter. D. Method Main: Prompt the user to input a shape name and color Prompt the user to input a rectangle color, length and with . Prompt the user to input a circle color and radius Create Shape, circle and Rectangle objects and initialise the objects with the values entered by the user Call method for each object to print the output
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
