Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Following the example of the Circle class in Section7.2, design a class named Rectangle to represent a rectangle. The classcontains: ¦ Two data fields named width and height .

A constructor that creates a rectangle with the specified width and height .The default values are 1 and 2 for the width and height , respectively.

A method named getArea() that returns the area of this rectangle.

A method named getPerimeter() that returns the perimeter.Draw the UML diagram for the class, and then implement the class.

Write a testprogram that creates two Rectangle objects-one with width 4 and height 40 and the other with width 3.5 and height 35.7 . Display the width, height, area,and perimeter of each rectangle in this order.

7.2

import math

2

3 class Circle:

4 # Construct a circle object

5 def __init__(self, radius = 1 ):

6 self.radius = radius

7

8 def getPerimeter(self):

9 return2 * self.radius * math.pi

10

11 def getArea(self):

12 return self.radius * self.radius * math.pi

13

14 def setRadius(self, radius):

15 self.radius = radius

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M93100201

Have any Question?


Related Questions in Computer Engineering

Question your paper should contain the following

Question: Your paper should contain the following information: • Describe the 3-level architecture. • Describe data independence. • Talk about the differences between a DA and a DBA. • Discuss the pros and cons of having ...

Question this discussion focuses on mapping cloud security

Question: This discussion focuses on mapping cloud security controls to existing frameworks or regulations. You will need to create 1 new thread AND post AT LEAST 2 comments on other students' threads. Here's how to get ...

Do you need computers or information and communication

Do you need computers or information and communication technologies to store, organize, and manage data in organizations? Explain how the present day organizations in a developed country like the USA store and manage the ...

Patient patientid familyname givenname address suburb state

PATIENT (PatientID, FamilyName, GivenName, Address, Suburb, State, PostCode) DOCTOR (ProviderNo, Name) ITEM (ItemNo, Description, Fee) ACCOUNT (AccountNo, ProviderNo, PatientID, TreatmentDate) ACCOUNTLINE (AccountNo, Ite ...

Relational algebrawrite a relational algebra expression

[Relational Algebra] Write a relational algebra expression that will output first name and last name of computer science major male students who have borrowed books from "University of Iowa Main Library". Relational Sche ...

What are the differences between the federal deficit and

What are the differences between the Federal deficit and Federal Debt? How does a government budget deficit affect the economy, specifically the unemployment rate and job creation? Identify two periods in recent history ...

For the following c statement what is the corresponding

For the following C statement, what is the corresponding RISC-V assembly code? Assume that the variables f, g, h, and i are given and could be considered integers as declared in a C program. Use a minimal number of assem ...

Discuss how today the internet has brought millions of

Discuss how today, the internet has brought millions of unsecured computer networks into communication with each other.

Quesiton direct manipulation and virtual environments

Quesiton: "Direct Manipulation and Virtual Environments" Please respond to the following: • Your software development company has been contracted to build a tool that will manage user accounts and rights in an Active Dir ...

Step 1 pick a home appliance with significant user controls

Step 1: Pick a home appliance with significant user controls (e.g. Microwave, Stove/Range, Refrigerator, etc.). Do NOT select things like a TV remote control, computers, etc. Also do not select equipment that lack signif ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As