Question: Write code in python. Solve all 4 questions and describe the code working using comments. Also provide screenshots of output. 5. This question is centered

Write code in python.

Solve all 4 questions and describe the code working using comments.

Also provide screenshots of output.

Write code in python.Solve all 4 questions and describe the code working

5. This question is centered around the shape and price of two tables. Write a Python application as per the following instructions to display their shapes and prices. i. Create a class called 'Table' with two private variables namely 'shape' and 'price'. (2 Marks) ii. Include two 'setters' and two 'getters' in the "Table' class with appropriate arguments to set 'shape', 'price' and to get the 'shape', 'price" respectively. Also, include a method named 'showDetails()' that can display the 'shape' and 'price' of tables in a meaningful way. (See the required output given in the part iv.) (6 Marks) ili. Create two subclasses of the Table' class called Round' and 'Square', only for the purpose of creating objects. (4 Marks) iv. Create individual objects of the two subclasses 'Round' and 'Square' respectively and write the code to display details ('shape' and 'price") of the Round table and Square table separately when a user sets the shapes as Round' , 'Square' and the prices as 35000. 25000 respectively to the private variables. Required Output: Round Table is Rs. 35000 Square Table is Rs. 25000 (4 Marks) v. Indicate the code segments where Encapsulation, Inheritance and Polymorphism were implemented by inserting appropriate comments and discuss the advantages gained by incorporating those features into the code. (4 Marks) (Total 20 Marks) End of Question Paper

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!