use only python programming language. 5. This question is centered on two types of gems namely a
Fantastic news! We've Found the answer you've been seeking!
Question:
use only python programming language.
Transcribed Image Text:
5. This question is centered on two types of gems namely a 'Sapphire' and a 'Topaz'. 'Sapphire' is blue, has an oval shape, and is priced at USD 150 while 'Topaz' is yellow, and has a heart shape, and is priced at USD 220. Write a Python application as per the instructions provided in parts i. ii. iii. and iv. to display the details of the two gems as follows: The price of Oval shaped Blue Sapphire is USD 150. The price of Heart shaped Yellow Topaz is USD 220. i. Create a class called 'Gem' with four (4) private variables namely 'gem_type', 'shape', 'color', and 'price'. (2 Marks) ii. Include four (4) 'setters' and four (4) 'getters' in the 'Gem' class with appropriate arguments to set data into the fields 'gem_type', 'shape', 'color', 'price' and to get those data from the four (4) fields respectively. Also, include a reusable method named 'showDetails()' that can display the two given outputs by getting the set data from the fields. (6 Marks) iii. Create two subclasses of the 'Gem' class called 'Sapphire' and 'Topaz', for the purpose of creating objects. (4 Marks) iv. Create two individual objects (one from each) of the subclasses 'Sapphire' and 'Topaz' respectively and use them to set data into the fields, get data from the fields and call the method 'showDetails()' to get the required output. (4 Marks) v. Indicate the code segments where Encapsulation, Inheritance, and Polymorphism were implemented by inserting appropriate comments. Also, discuss the advantages gained by incorporating those features into the code. (4 Marks) 5. This question is centered on two types of gems namely a 'Sapphire' and a 'Topaz'. 'Sapphire' is blue, has an oval shape, and is priced at USD 150 while 'Topaz' is yellow, and has a heart shape, and is priced at USD 220. Write a Python application as per the instructions provided in parts i. ii. iii. and iv. to display the details of the two gems as follows: The price of Oval shaped Blue Sapphire is USD 150. The price of Heart shaped Yellow Topaz is USD 220. i. Create a class called 'Gem' with four (4) private variables namely 'gem_type', 'shape', 'color', and 'price'. (2 Marks) ii. Include four (4) 'setters' and four (4) 'getters' in the 'Gem' class with appropriate arguments to set data into the fields 'gem_type', 'shape', 'color', 'price' and to get those data from the four (4) fields respectively. Also, include a reusable method named 'showDetails()' that can display the two given outputs by getting the set data from the fields. (6 Marks) iii. Create two subclasses of the 'Gem' class called 'Sapphire' and 'Topaz', for the purpose of creating objects. (4 Marks) iv. Create two individual objects (one from each) of the subclasses 'Sapphire' and 'Topaz' respectively and use them to set data into the fields, get data from the fields and call the method 'showDetails()' to get the required output. (4 Marks) v. Indicate the code segments where Encapsulation, Inheritance, and Polymorphism were implemented by inserting appropriate comments. Also, discuss the advantages gained by incorporating those features into the code. (4 Marks)
Expert Answer:
Answer rating: 100% (QA)
Answer 1 The system or physical system A physical system is a collection of physical objects In phys... View the full answer
Posted Date:
Students also viewed these computer engineering questions
-
Define the following terms related to reciprocating engines: stroke, bore, top dead center, and clearance volume.
-
Define the following terms used in FASB Statement No. 13 as Amended: (a) Inception of lease, (b) Bargain purchase option, (c) Unguaranteed residual value, (d) Implicit interest rate, (e) Initial...
-
Define the following terms regarding preferred stock: (a) Dividend preference, (b) Cumulative, (c) Participating, (d) Convertible, (e) Warrants, (f) Callable, and (g) Redeemable.
-
The AFL-CIO has undertaken a study of the yearly salaries (in thousands of dollars) of 30 administrative assistants. The organization wants to predict salaries from several other variables. The...
-
The following are the amounts of the assets and liabilities of New World Travel Agency at December 31, 2015, the end of the current year, and its revenue and expenses for the year. The capital of...
-
Tompkins was injured on "a dark night" by something protruding from a passing freight train owned by Erie Railroad Company as Tompkins stood next to the tracks in Pennsylvania, He claimed the...
-
In the Bohr model of the hydrogen atom, an electron orbits a nucleus consisting of one proton. Given that the electron and proton are both spinning, describe the types of magnetic interactions you...
-
Big-J Construction Company, Inc. (Big-J CC) is conducting routine periodic review of existing field equipment. The owner of Big-J CC has asked for a replacement evaluation of a paving machine now in...
-
The price of a car you want is $39,000 today. Its price is expected to increase by $1000 each year. You now have $23,500 in an investment account, which is earning 11% per year. How many years will...
-
Jocame Inc. began business on January 2, 20Y7. Salaries were paid to employees on the last day of each month, and social security tax, Medicare tax, and federal income tax were withheld in the...
-
1. What will the monthly mortgage payments be ( PI only ) on a $ 4 3 2 , 3 7 5 , 1 5 - year, 6 . 7 % annual interest mortgage? 2. What will the monthly mortgage payments be ( PI only ) on a $ 7 8 5...
-
Management accounting combines accounting, finance and management with the leading edge techniques needed to drive successful businesses. Chartered management accountants: Advise managers about the...
-
According to an article authored by Yayla-Kll et al., multi-product firms account for 91 per cent of the output in US manufacturing and they often make short- to medium-term adjustments in their...
-
Each year, the paper and pulp industry produces millions of tonnes of sludge in the production of paper. This sludge is typically disposed of in landfill sites or incinerated. Both disposal methods...
-
Dice simulation. The following code computes the exact probability distribution for the sum of two dice: int[] frequencies = new int[13]; for (int i = 1; i
-
Google Suspended TechNxts AdWords Account: Strategy Formulation and Implementation Google suspended TechNxt Technologies AdWords account to promote its own Google Helpouts product. The service added...
-
What is printed as a result of executing the following code segment? List list 1 = 1 = new ArrayList ( ) ( ) ; list 1 . 1 . add ( " ( " a " ) " ) ; list 1 . 1 . add ( " ( " b " ) " ) ; list 1 . 1 ....
-
Explain how two samples can have the same mean but different standard deviations. Draw a bar graph that shows the two samples, their means an standard deviations as error bars. T S
-
Acne Medication and Gastrointestinal Injury Since 1999, Kamie Kendall had experienced ongoing abdominal pain, and she was eventually diagnosed with ulcerative colitis and irritable bowel syndrome...
-
CMS is a claims processing company in Mobile, Alabama. Chastity Jones, a black woman, completed an online employment application for a customer service position with CMS. Jones interviewed with a...
-
One critical-thinking skill is a heightened awareness of the danger of reaching a conclusion prior to acquiring missing information that were it known would have a reasonable probability of altering...
Study smarter with the SolutionInn App