Draw and manipulate simple geometric shapes

Assignment Help Computer Graphics
Reference no: EM13779481

You are developing a simple graphics package that will allow you to draw and manipulate simple geometric shapes such as squares, rectangles, etc. Your initial design is along the following lines:

public class Rectangle {

private int h, w;

public int getHeight() {...}

public int setHeight(int x) {...}

...

}

public class Square extends Rectangle {

// ???

}
This question has a ‘devil's advocate' nature to it and is in two parts.

You intend to model a square as inheriting from a rectangle. How would you complete the code on the above right to realize this intention?
No matter how you do design the code for the square, you will be able to write code that will break the meaning of what it means to be a square or rectangle. After completing Part a, discuss the flaw in your design and outline some code that will cause it to break (your code should compile fine and will also execute without an error but will violate how a rectangle or square should behave).

 

Reference no: EM13779481

Questions Cloud

Efficiency and reducing the profitability of business : Explain whether you believe that there is too little regulation and protection for business in the United States or whether you think that there is too much regulation slowing down the efficiency and reducing the profitability of business in this ..
Reimbursement methodologies class : Review each of the four components of the revenue cycle (Preclaims, Claims, Accounts Receivable, and Claims, reconciliation and collections) and identify a key staff member involved in each of the four components.
Provide the six sigma process : A product has specification limits of 6.0 ounces and 6.5 ounces.  The company of this product states that the product weighs 6.2 ounces. If the company wants to have a Cpk of 2.0 or greater, what is the maximum value of the standard deviation (?) so ..
How is justice defined : Justice is one of the five core ethical principles in healthcare. Does the article discuss justice in terms of procedural or distributive justice? How is justice defined?
Draw and manipulate simple geometric shapes : You are developing a simple graphics package that will allow you to draw and manipulate simple geometric shapes such as squares, rectangles, etc
Number of applications or tuition costs : Using a regression model, if a question states that a college believes that decreases in number of student applications are directly and linearly related to tuition prices, what would be the Y Range (number of applications or tuition costs)?
Discussion on leadership and motivation : Next, state whether or not you think such leadership characteristics are innate or learned. Provide a rationale for your response
What guaranteed mileage should the manufacturer announce : A new extended-life light bulb has an average service life of 768 hours, with a standard deviation of 45 hours. If the service life of these light bulbs approximates a normal distribution, about what percent of the distribution will be between 617 ho..
Business mapping of processes issue : What causes these? What is the impact on cycle times?

Reviews

Write a Review

Computer Graphics Questions & Answers

  1 identify the 5 elements of strategy for home depot2 do a

1. identify the 5 elements of strategy for home depot.2. do a swot analysis for home depot and provide recommendations

  Task apple corpyou will assess the recent acquisitions of

task apple corp.you will assess the recent acquisitions of your selected firm apple. use print and online sources to

  Incorporates text as an integral part of the image

use illustrator to draw, focus on typography to create an illustration that incorporates text as an integral part of the image or image shape

  Bullhow ismight the strategic plan be communicated to

bullhow ismight the strategic plan be communicated to various levels o management a variety of differing teams and to

  Calculate and plot projection of rectangle on image plane

There is a rectangle with vertices at (-6,-3,6)T, (3,-3,6)T, (3,3,9)T, and (-6,3,9)T. What is the 3x4 perspective camera matrix? Calculate and plot the projection of the rectangle on the image plane.

  Perform an internal and external competitive environmental

perform an internal and external competitive environmental scan for your organization. the organizations name is flat

  What role does corporate-level strategy play in relation to

what role does corporate-level strategy play in relation to business-level strategy?what roles do a firms core

  Choose one of the organisations and examine their

choose one of the organisations and examine their commercial practices in light of ethical behavioural theory you have

  Draw and explain the diagram of a raster scan system

Draw and explain the diagram of a Raster scan system with a display processor. Explain each unit of the diagram.

  Redraw the circle

In the first round, the circle should stay visible for 1 second and each subsequent round the visible time should be 25% shorter than the previous round

  A graduate student has four job offers and needs to accept

a graduate student has four job offers and needs to accept one. the following table lists the four jobsnbspnbspthese

  Program that bounces a blue ball inside jpanel

Create a program that bounces a blue ball inside a JPanel. The ball should start moving with a mousePressed event. When the ball hits the edge of the JPanel, it should bounce off the edge and continue in the reverse direction.

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