Flaw in your design and outline

Assignment Help Computer Graphics
Reference no: EM13165508

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.

1. 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?

2.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: EM13165508

Questions Cloud

People must be in a group in order to guarantee : How many people must be in a group in order to guarantee that two people in the group have the same birthday (don't forget leap year)?
This function should accept a two-dimensional : getLowestInRow. This function should accept a two-dimensional array as its argument and an integer as its second argument. The second argument should be the subscript of a row in the array. The function should return the lowest value in the specif..
Considered to be an improved version : Part (c) is considered to be an improved version of Part (b). You may use an array (2-dimessional) to store some values that has been computed during the run so that when making recursive calls the program does not compute certain values over and ..
What mass of this substance must evaporate : What mass of this substance must evaporate in order to freeze 112 of water initially at 18? (The heat of fusion of water is 334 the specific heat of water is 4.18 .
Flaw in your design and outline : 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).
Calculate the mole percent composition of the mixture : Calculate the weight percent composition of the mixture, using the same assumptions as in part A.
Modify the book class to accommodate multiple authors : modify the Book class to accommodate multiple authors using one of the components from the Java Collection Framework.
What is the empirical formula of the hydrocarbon : 4.236-g sample of a hydrocarbon (CxHy) is combusted in O2 completely to give 3.810 g of H2O and 13.96 g of CO2. What is the empirical formula of the hydrocarbon?
Write a test program that prompts the user : public static int binaryToDecimal(String binaryString)Write a test program that prompts the user to enter a binary string and displays its decimal equivalent.

Reviews

Write a Review

Computer Graphics Questions & Answers

  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.

  Practices for web graphics

Assume your Web design firm has just hired a talented graphic artist with years of expertise in print media and no experience with creating image production.

  Selecting bit mapped or vector graphics

For each of the provide a detailed rational for selecting bit mapped or vector graphics when they used in a web based application,

  Potential multimedia presentation

Create a short description of a potential multimedia presentation that could be implemented across the WWW for a particular subject of interest to you.

  Discuss website design basics

Juan arrived the end of his online course program. His family was so proud of him. Juan's wife wish to throw a party to celebrate Juan's online graduation together with all of his family, and started planning the special event.

  Opengl assignment using c++

This is an OpenGL assignment using C++. Work on a particle and mesh visualization tool. Data: Consider a point cloud as input data. Every point is described by a position p = (x, y, z) and a data value d = (d0,d1,d2).

  Question about troubleshooting problem

Consider the most difficult troubleshooting problem you have encountered in your recent experience- one where the solutions was not straightforward

  .what will happen if you connect p3.5 at the buzzer

Consider the following code segment. Assume that processor clock in the active mode is set to 1,000,000 Hz. In this mode the platform draws 0.5 mA.

  Question about educational technology

Educational technology helps to create workers's training cheaper, more individual and more effective. Based on your experience, describe a method that exploits

  Determine when would a transition be appropriate

Some animation schemes include slide transitions and some do not. Determine when would a transition be appropriate? When would it not be appropriate?

  Discussion on internet development

In 1990s, the Internet offered primarily text based web-sites. At present the Internet is rich in multimedia sites that include audio and video.

  Create a simple warm-up program using your g3d

Create a simple warm-up program using your G3D programming and graphics environment.

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