use UML graphical notations to describe classes and objects.
use UML graphical notations to describe classes and objects.
1.)
class Investment:
def __init__(self,p,i,n):
self.p=p
self.i=i
self.n=n
def value_after(self):
return ((self.p*(1+self.i))**self.n)
def __str__(self):
print('Principal-$:',self.p, 'Interest rate:',self.i,'%','Interest-$:',a.value_after())
a=Investment(2000,6.32,5)
(a.__str__())
2.)
class Rectangle:
def __init__(self,w=1,h=2):
self.width = w;
self.height = h;
def getArea(self):
return self.width*self.height
def getPerimeter(self):
return 2*(self.width+self.height)
w = 4
print ("The width of the rectangle is "+str(w))
h = 40
print ("The height of the rectangle is "+str(h))
r = Rectangle(w,h);
print('The area of the rectangle is', r.getArea())
print('The perimeter of the rectangle is', r.getPerimeter())
w = 3.5
print("The width of the rectangle is "+str(w))
h = 35.7
print("The height of the rectangle is "+str(h))
r = Rectangle(w,h);
print("The area of the rectangle is", (r.getArea()))
print("The perimeter of the rectangle is", (r.getPerimeter()))
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 2 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)