I've been assig to do the class rectangle, the class has two instance variables: length and width of the rectangle, and the methods methods setLength(), getLength(), setWidth(), getWidth() and computeArea(). Do you have any idea to do this. Anyway i'm to to python.
Mistyz 0
Newbie Poster
Recommended Answers
Jump to PostStart by declaring a class named
Rectangle
. Write a constructor (an__init__()
method) that accepts argumentsself
,length
andwidth
, and assign the latter two toself.length
andself.width
inside the constructor.
All 3 Replies
ddanbe 2,724
Professional Procrastinator Featured Poster
Schol-R-LEA 1,446
Commie Mutant Traitor Featured Poster
ZZucker 342
Practically a Master Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.