Question

Python UML .Can anyone helpe to understand the pthon UML, I appreicated it . Giving the...

Python UML .Can anyone helpe to understand the pthon UML, I appreicated it .

Giving the python code as follows:

class C(object): pass

class D(object): pass

class A(object):

def _ _init_ _(self,x,y);

self.x=x; self.y=y;

def hello (self,str);

prnt(str +str(c))

class B(A);

def _ _init_ _(self);

#this is "aggregation" not composition"

self.c= C

self.d= D

if _ _name_ _ =="_ _main_ _";

a=A(10,20) #

a=A(20,30) #

(a)Draw an UML Class Diagram of A ,and an UML Class Diagram of B

(b)Draw an UML object Diagram of A and an object Diagram of B

(c)Draw an UML diagram to describe the relationship between A and C; an UML diagram relationship between A and B; an UML diagram  relationship between B, C and D

0 0
Add a comment Improve this question Transcribed image text
Answer #1

am fo Clans R hello stject helloLynn L

Add a comment
Know the answer?
Add Answer to:
Python UML .Can anyone helpe to understand the pthon UML, I appreicated it . Giving the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Page 3 of 7 (Python) For each substring in the input string t that matches the...

    Page 3 of 7 (Python) For each substring in the input string t that matches the regular expression r, the method call re. aub (r, o, t) substitutes the matching substring with the string a. Wwhat is the output? import re print (re.aub (r"l+\d+ " , "$, "be+345jk3726-45+9xyz")) a. "be$jk3726-455xyz" c. "bejkxyz" 9. b. "be$jks-$$xyz" d. $$$" A object a- A (2) 10. (Python) What is the output? # Source code file: A.py class A init (self, the x): self.x-...

  • [Problem 5] List all that the following Python class is missing in order to function. [10...

    [Problem 5] List all that the following Python class is missing in order to function. [10 Points] import math class TwoCoordinatePoints (object): #This class represents a point A = (x, y) with integer values for x and y. -_init__(x, y): self.x = x self.y = y def -_str__(self): "(%, %)" % (self.x, self.y) def distance (self, P): #computes the distance between two points (instances) of this class return math.sqrt((self.x-P.x)**2+(self.y-P.y)**2)

  • ## python oop creating a large number of instances ## im trying to create a large...

    ## python oop creating a large number of instances ## im trying to create a large number of instances for a class. could you show me a way to make it work import math import random class soldiers: def __init__(self,x,y): self.x = x self.y = y def get_target(self,x,y,number_red_soldiers,number_blue_soldiers): pass # self.target = def aiming_angle(self,x,y,target,enemy_x,enemy_y): dy = self.y-enemy_y[target] dx = self.x-enemy_x[target] angle =math.atan(dy/dx) a = 0 number_blue_soldiers= 10 number_red_soldiers = 10 for i in range(number_blue_soldiers): blue_x = random.randint(0,100,10) blue_y = random.randint(0,100,10)...

  • 9p This is for Python I need help. Pet #pet.py mName mAge class Pet: + __init__(name,...

    9p This is for Python I need help. Pet #pet.py mName mAge class Pet: + __init__(name, age) + getName + getAge0 def init (self, name, age): self.mName = name self.mAge = age Dog Cat def getName(self): return self.mName mSize mColor + __init__(name, age,size) + getSize() + momCommento + getDog Years() +_init__(name, age,color) + getColor + pretty Factor + getCatYears def getAge(self): return self.mAge #dog.py import pet #cat.py import pet class Dog (pet. Pet): class Cat (pet. Pet): def init (self,...

  • 1) This exercise is about Inheritance (IS-A) Relationship. A) First, draw the UML diagram for class...

    1) This exercise is about Inheritance (IS-A) Relationship. A) First, draw the UML diagram for class Student and class ComputerSystemsStudent which are described below. Make sure to show all the members (member variables and member functions) of the classes on your UML diagram. Save your UML diagram and also export it as a PNG. B) Second, write a program that contains the following parts. Write each class interface and implementation, in a different .h and .cpp file, respectively. a) Create...

  • 12p I need help this is Python EXCEPTIONS: It's easier to ask forgiveness than permission. Try...

    12p I need help this is Python EXCEPTIONS: It's easier to ask forgiveness than permission. Try the code and catch the errors. The other paradigm is 'Look before you leap' which means test conditions to avoid errors. This can cause race conditions. 1.Write the output of the code here: class MyError(Exception): pass def notZero(num): if num == 0: raise MyError def run(f): try: exec(f) except TypeError: print("Wrong type, Programmer error") except ValueError: print("We value only integers.") except Zero Division Error:...

  • Use of search structures! how can i make this program in python? Learning Objectives: You should...

    Use of search structures! how can i make this program in python? Learning Objectives: You should consider and program an example of using search structures where you will evaluate search trees against hash tables. Given the three text files under containing the following: - A list of students (classes Student in the distributed code) - A list of marks obtained by the students (classes Exam results in the distributed code) - A list of topics (classes Subject in the distributed...

  • ii. (30) A Stack is a container commonly used to provide a way to keep organized...

    ii. (30) A Stack is a container commonly used to provide a way to keep organized so that the last one pushed' onto the top of the stack is thth one 'popped (removed)- so stacks are called "last-in-first-out". on top of the stack is visible, but after removing the top item, t pushed item is visible, since it is back on top. The following Python co is a recursive definition of the class Stack. Read the code, and answer te...

  • Please answer python questions? class ItemPack ): 21 def-init--(self): self.--storage=[] self. _.jump -1 self. _.mid-self. ..jump...

    Please answer python questions? class ItemPack ): 21 def-init--(self): self.--storage=[] self. _.jump -1 self. _.mid-self. ..jump def __iter.(self) self._.mid-int (len (self..storage)-1)/2.0) self. _.jump 0 return (self def __next..(self): 10 ind self .-_aid+self.--jump if ind<0 or ind >=len (self.--storage): 12 13 14 15 raise StopIteration O vToRet self.--storage [ind] if self.--jump <=0 : self.--Jump 1-self.--Jump - else return (vToRet) self..storage.append (item) return (len(self.--storage)=#0) 17 self.--jump*=-1 19 20def stuff (self, item) 21 22def isEmpty (self) 24def unpack (self): if len (self. .storage)0return...

  • PYTHON 3 Object Oriented Programming ***a9q3.py file below*** class GradeItem(object): # A Grade Item is anything...

    PYTHON 3 Object Oriented Programming ***a9q3.py file below*** class GradeItem(object): # A Grade Item is anything a course uses in a grading scheme, # like a test or an assignment. It has a score, which is assessed by # an instructor, and a maximum value, set by the instructor, and a weight, # which defines how much the item counts towards a final grade. def __init__(self, weight, scored=None, out_of=None): """ Purpose: Initialize the GradeItem object. Preconditions: :param weight: the weight...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT