Create a program that uses an array of Shape references to objects of each concrete class in the hierarchy (see program-2). The program should print a text description of the object to which each array element refers. Also, in the loop that processes all the shapes in the array, determine the size of each shape If it‟s a TwoDimensionalShape, display its area. If it‟s a ThreeDimensionalShape, display its area and volum ​

Answers

Answer 1
You got any social media would send you the rest. If you want it.
Create A Program That Uses An Array Of Shape References To Objects Of Each Concrete Class In The Hierarchy
Answer 2

The program uses an array for shape reference to objects of each concrete class given. The program is in text description in java language.

What is a program array?

Array programming in computer science refers to methods that allow operations to be applied to a whole set of values at once. This kind of solution is frequently used in scientific and engineering settings.

Shape.java

public abstract class Shape { private int sides;

public Shape() {

this.sides=0;

}

public Shape(int sides) { super(); this.sides = sides;

}

public int getSides() { return sides;

}

public void setSides (int sides) { this.sides = sides;

}

public abstract double calcArea();

Override

public String toString() {

return "This Shape has [sides=" + sides + "]";

Therefore, the program array is given above.

To learn more about program array, refer to the link:

https://brainly.com/question/13104121

#SPJ2


Related Questions

Other Questions
The Embargo Act of 1807 had which of the following effects on the United States? Find the cost per roll if a bag of five lunch rolls is $2.50. What is the answer person with correct answer gets marked brainliest A car is traveling 70km in 45 minutes. How many miles an hour is the car traveling? if you have a bacteria cell that you touch at 9:00 am (so now you have one cell on you) and it multiplies every 20 mins how much will i have on me at 4:00 Use the formula for annual compound interest. A = P (1 StartFraction r Over n EndFraction)nt Remember, A refers to the total amount owed. Calculate the total amount that Tom would repay. $10,337 $11,337 $12,337 $13,337. If you have to decide to claim a credit or deduction on your taxes which should you take? if angle d is 15 what is angle CED? Angular unit test how to use jest with karma. A box of pens cost $6.50 and a box of pencils is $4.00. Jane gets 15% commission of each box of pencils sold. Calculate Jane's commission if sells 20 boxes 2. How many tens are in 9 hundreds? what does cost-effective mean? im kind of confused on cost-effective and time-effective things and i keep getting mixed up :( Describe two important details about industrialization in Europe in the 19th century which number describes the national census of texas in 1850 What is the vertex and p-value of this parabola? A company rents out 16 food booths and 20 game booths at the county fair. The fee for a food booth is $200 plus $9 per day. The fee for a game booth is $95 plus $6 per day. The fair lasts for d days, and all the booths are rented for the entire time. Enter a simplified expression for the amount, in dollars, that the company is paid. The keys to the success of the Mongolian military in the 1200s included The efforts described in the excerpt above can best be understood in the context of attempts to match democratic political ideals with social realities. attempts to match democratic political ideals with social realities. the development of distinctive cultures by various groups of people. the development of distinctive cultures by various groups of people. governmental and private efforts to promote the American System. governmental and private efforts to promote the American System. racist and nativist theories used to justify violence and segregation. f(x) =2^x4g(x) = 5/xevaluate g(f(2))= HELPPPPPPPPPPPPPPPPPP