Example of the circle class

Assignment Help Basic Computer Science
Reference no: EM131160363

(The Rectangle class) Following the example of the Circle class in Section 9.2, design a class named Rectangle to represent a rectangle. The class contains:

  • Two double data fields named width and height that specify the width and height of the rectangle. The default values are 1 for both width and height.
  • A no-arg constructor that creates a default rectangle.
  • A constructor that creates a rectangle with the specified width and height.
  • 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 test program that creates two Rectangle objects-one with width 4 and height 40 and the other with width 3.5 and height 35.9. Display the width, height, area, and perimeter of each rectangle in this order.

Reference no: EM131160363

Questions Cloud

Calculate the total number of hours joe : Joe Jackson worked 8 hours on Monday, 4 1/4 hours on Tuesday, 6 1/8 hours on Wednesday, 7 1/4 hours Thursday and 8 1/8 hours on Friday. Calculate the total number of hours Joe worked for the week.
How economists are both scientists and policymakers : How economists are both scientists and policymakers and what principles society uses to allocate its scarce resources. Using the circular flow model, explain the flow of money and goods in an economy.
Discussed first price sealed bid auction with two bidders : In class, we discussed a first price sealed bid auction with two bidders. Each bidder’s valuation v was a random draw from the interval [0, 1] according to the uniform cumulative distribution function F(v) = v for 0 £ v £ 1. Now suppose there are n ≥..
Tax should be levied on employers or employees : Suppose that Jean is an unskilled worker who is making the market wage of $7 per hour and that the market for unskilled labor is competitive. Assume there is no minimum wage. If Jean could lobby the government, what position should she take regarding..
Example of the circle class : (The Rectangle class) Following the example of the Circle class in Section 9.2, design a class named Rectangle to represent a rectangle. The class contains:
Describe which theory believe best describes intelligence : Provide a summary of the different theories of intelligence proposed in the textbook (Spearman, Sternberg, Gardner, and Salovey/Mayer's theories); Describe which theory you believe best describes intelligence;
Solving a business challenge using wlan technology : Highbrow Ed is a rapidly growing educational institution with over 3,000 students spread across five regional campuses. Most students live in off-campus housing. Highbrow's Chief Information Officer (CIO) wants to incorporate electronic collaborat..
Develop a conceptual model by outlining : Write a consultancy report about your study considering all of the steps listed below in the given order - The two arrival processes and the service delays have to be modelled stochastically. The model has to provide graphical output for at least o..
Which platform has a higher market share : Which platform has a higher market share? What are the common security concerns for both platforms? Which platform would you suggest implementing and why?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Describe the skills or knowledge a project manager need

Describe the categories into which you would divide your attribute.

  How is the principle of inclusion and exclusion related

How is the principle of inclusion and exclusion related to the rules for manipulation and simplification of logic predicates you learned in Ch. 2

  Automated emails from google apps spreadsheet ?

How to send automated emails from google apps spreadsheet ?

  How many of the bits in a 6 bit unsigned number

Design a logic circuit to figure out how many of the bits in a 6 bit unsigned number equal 1. Design the simplest possible circuit to accomplish this.

  Vba programming homework

VBA Programming homework: 1. A cosine can be approximated by the following infinite series: cosx=1-(x2/2!)+(x4/4!)-(x6/6!)+...

  What are the reasons for having variable-length records

What are the reasons for having variable-length records?

  Footer element describes content appears bottomtrue or false

The footer element describes content that usually appears at the bottom of the content or section element. True or False

  Select processor or disk for economical view

Similary there is set of disk drives for $7000 which promises two and half times the throughout of your existing disks. Then in economical view whether processor or disk is to select for your computer?

  Implementation phases of the sdlc

Describe the fundamental purposes of the systems analysis, systems design, and implementation phases of the SDLC and the activities in each phase. Compare and contrast the Waterfall Model and Spiral Life Cycle Model for these activities.

  Demonstrate your understanding and knowledge gained

Demonstrate your understanding and knowledge gained about session's material. Complete with a short discussion for each question. The second question will take several paragraphs to answer thoroughly.

  Convert the decimal integer

Convert the decimal integer -24 to 16 bit and 32 bit two's complement hexadecimal representation. show your calculations.

  Specific types of security breaches

Keeping information systems secure is a major task, both for information security professionals and everyone who uses a network such as the Internet. Discuss 3 specific types of security breaches that could occur as you use the Internet.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd