Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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.
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 PaperStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started