Question: Problem PQ 5 . Writing Object - Oriented Python Code. ( a ) [ 1 5 points ] Complete the code below for an Element

Problem PQ5. Writing Object-Oriented Python Code.
(a)[15 points] Complete the code below for an Element class.
It will have attributes for symbol, atomic number, and atomic weight. For example,
helium has symbol He, atomic number 2, and atomic weight 4.003.
Write a 3-parameter constructor init that can be used to set all three attributes,
with default attribute values of "",0, and 0.0, respectively.
Write getter and setter instance methods for the atomic number only.
class Element:
(b)[5 points] Add Python statements to create an application program below that (i) creates
and initializes the Element object helium using your constructor and all three of its actual
attribute values (listed above); (ii) creates an list of objects that could be used for all 118
elements of the periodic table, but with only the atomic number initialized to a non-default
value.
# test the Element class
Problem PQ 5 . Writing Object - Oriented Python

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!