Answered step by step
Verified Expert Solution
Link Copied!

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.

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

Describe Balor method and give the chemical reaction.

Answered: 1 week ago

Question

How to prepare washing soda from common salt?

Answered: 1 week ago

Question

Explain strong and weak atoms with examples.

Answered: 1 week ago