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

  Determine the number of sub strings

Determine the number of sub strings that start with the character 'I' and end with 'E' in the word below. Show all the work. I N T E L L I G E N C E

  What is the result of removing the 10 from the 2-3 tree

To be sure that you fully understand the insertion algorithm, insert 32 into the 2-3 tree in Figure 19-11. The result should be the tree shown in Figure 19-6 b. Once again, compare this tree with the binary search tree in Figure 19-6 a and notice ..

  Write a program that reads a number x from the user

Please use MIPS and MARS ida Write a program that reads a number x from the user, and prints the first x letters of the alphabet (in lower case). You do not need to check whether the number is positive.

  Colliding signals in a transmission cable

Suppose two nodes, A and B, are attached to opposite ends of an 800 m cable, and that they each have one frame of 1024 bits (including all headers and preambles) to send to each other.

  Determine the type of muscle tissues

The image below shows a longitudinal view of a type of muscle.  Note the multiple nuclei that lie at the periphery of the muscle fibers as well as the striations (thin lines) formed by the arrangement of the thick and thin myofilaments.

  Internet functionality or particular applications

Each week, you'll have to post on at least three separate days to the Discussion. Each post should be of a high quality.  Your first post should be by Wednesday.

  How assembly is organized

How Assembly is organized

  What is the probability q that a random ticket will be a win

What is the expected value of Wn, the prize you collect for your winning ticket?

  Algebraic expressions for parts

Write your birth date or the birth date of someone in your family as mm/dd/yy. (Example: March 13, 1981 is written 3/13/81, and November 7, 1967 is written 11/7/67).

  It ethics and responsible conduct

Many mobile devices and apps track and report location and activity information of the users. Please respond to the following in not more than 250 words:

  Discuss arrays and access array elements

Write a 2 page research paper on creating and accessing arrays. Explain the concepts using at least one example. Use at least two resources (Wikipedia sources are not permitted) and list each resource used at the end of paper in the reference lis..

  Bmw deal with exchange rate risk

Although the dollar pushed to a new 11-year high against the euro recently due to a strong U.S. jobs report and market expectations for the Federal Reserve to raise interest rates midyear, the dollar was relatively weak four years ago as well as d..

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