Define two derived classes of the abstract class

Assignment Help C/C++ Programming
Reference no: EM13162450

Define two derived classes of the abstract class ShapeBase below. Your two classes will be called RightArrow and LeftArrow. These classes will draw arrows that point right and left, respectively. The size of the arrow is determined by two numbers, one for the length of the tail and one for the width of the arrowhead. These values are 16 and 7 in the above display. The width of the arrowhead cannot be an even number, so your constructors and mutator methods should check to make sure that it is always odd. Write a test program for each class that tests all methods in the class. You can assume the width of the base of the arrowhead is at least 3.

 

*

* *

* *

**************** *

* *

* *

*

 

 

// Base class (ShapeBase)

public abstract class ShapeBase implements ShapeInterface{

protected int offset;

// I made offset protected so that the subclasses can refrence it directly

public void setOffset(int newOffset)

{

offset = newOffset;

}

public int getOffset()

{

return offset;

}

public abstract void drawHere();

public void drawAt(int lineNumber)

{

for(int i=0; i<lineNumber; i++)

System.out.println();

drawHere();

}

}

// Shape Interface

public interface ShapeInterface{

public void setOffset(int offset);

public int getOffset();

public void drawAt(int lineNumber);

public void drawHere();

}

 

 

 

Reference no: EM13162450

Questions Cloud

Find evidence that the hydroxyl radical is formed in flames : In combustion studies of H2 as an alternative fuel, you find evidence that the hydroxyl radical (HO) is formed in flames by the following reaction
What is the total pressure in torr of a gas : What is the total pressure in torr of a gas in a sealed flask that contains oxygen at a partial pres. of 0.41atm and water vapor at a partial pres. of 358mmHg?
Calculate the maximum percent yield of product : The solubility of the K3[Fe(C2O4)3].3H2O product at 00C is 4.7 g per 100 g water. Given this, calculate the maximum percent yield of product for your own reactant quantities.
State what is the concentration of f2 over a bath : Na3AlF6(l) 3 Na(l) + Al(l) + 3 F2(g) What is the concentration of F2 over a bath of molten cryolite at this temperature? a) 3 10-35 M b) 5 10102 M c) 6 10-74 M d) 8 10-312 M e) 8 1017 M
Define two derived classes of the abstract class : Define two derived classes of the abstract class ShapeBase below. Your two classes will be called RightArrow and LeftArrow. These classes will draw arrows that point right and left,
What is the rate constant for the reaction : What is the rate constant for the reaction at 85°C?
What was the concentration of the hcl solution : A 479-mL sample of unknown HCl solution reacts completely with Na2CO3 to form 12.1 g CO2. What was the concentration of the HCl solution?
Predict the effect of decreasing the container volume : Predict the effect of decreasing the container volume on the amounts of each reactant and product in the following reactions. (NOTE: Only ONE submission is allowed for this question.)
What is wrong with this description : 420 g of butane reacts with 1510 g of oxygen to produce 1390 g of carbon dioxide and 652 g of water.What is wrong with this description?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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