Design program which uses array of shape

Assignment Help Programming Languages
Reference no: EM1372715

Implement the Shape hierarchy shown below. Each TwoDimensionalShape should contain method getArea to calculate the area of the two-dimensional shape. Each ThreeDimensionalShape should have methods getArea and getVolume to calculate the surface area and volume, respectively, of the three-dimensional shape. Create a program that uses an array of Shape references to objects of each concrete class in the hierarchy. 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 whether each shape is a TwoDimensionalShape or a ThreeDimensionalShape. If a shape is a TwoDimensionalShape, display its area. If a shape is a ThreeDimensionalShape, display its area and volume.

Reference no: EM1372715

Questions Cloud

How much work is done on the gas : A motorboat heads due east at 11.00 m/s across a river that flows toward the south at a speed of 3.40 m/s. What is the resultant velocity relative to an observer on the shore? If the river is 1360m wide, how long does take the boat to cross.
Factors that influence resistance to social change : Describe the various factors that influence resistance to social change and give examples to support your answers. Explain the impact that technology has on influencing social change.
What is his annual inventory turns : Joe keeps only 5.5 days-of-supply of inventory on average because much of his inventory is live bait and micro-brew beer, both of which have a short shelf life. What is his annual inventory turns.
Find out the velocity of each object after the collision : Suppose you wish to lean a 3.00 m ladder against a smooth, vertical wall. The ladder's center of gravity is 2/3 of length from the top. If the coefficient of static friction between the ladder and the floor is 0.60, what is the largest angle ladde..
Design program which uses array of shape : Design a program which uses the array of Shape references to objects of each concrete class in hierarchy. The program must print text description of object to which each array element refers.
What was overall productivity of firm : A firm produces handbags using three workers. On Tuesday, Jane completed 60 bags in 6 hours, Ron completed 50 bags in 7 hours, and Mary completed 80 bags in 5 hours. What was overall productivity of firm.
Determine the torque generated by the friction forces : An electrical motor can accelerate a ferris wheel whose moment of inertia is 20,000 kg-m^2 from rest to 10 rev/min in 12 sec. When the motor is turned off, the ferris wheel slows down from 10 to 8 rev/min in 10 sec due to frictional losses.
Question about game theory terminology : Think of a time when you were involved in strategic decision making. This could be a business situation or a personal condition. It could be anything from buying inputs for a producing company,
Conflict theory-middle class economic security : Identify key elements of social class, as sociologists use the term. Identify how social class is constructed in everyday social settings. Evaluate perspectives on social structuring of inequality.

Reviews

Write a Review

Programming Languages Questions & Answers

  Write program to compute student-s quiz average

Write a program that will compute student's quiz average. Program must prompt the user for the number of quizzes and then ask the user for each quiz grade.

  Use switch statement to display roman numeral version

Use a switch statement to display the Roman numeral version of that number. Input Validation: Do not accept a number less than 1 or greater than 10.

  Complete a request for system services

Objectives Complete a Request for System Services form, which triggers the preliminary investigation phase. Analyze a user interview and extract pertinent facts, which can be used to assess project feasibility. Complete a Problem Stateme..

  Write parameterized function to play the game

Your program cannot use file level variables or constants; your program cannot use global variables or constants. The functions that you write exchange data by means of return statements and value parameters and reference parameters

  Program for vehicle registration department

Consulting firm has narrowed the choice of programming language to Java and C#. Which language do you believe would be more suitable for this application and why?

  Reducing the average memory access time

Suppose that increasing the line size to 128 bytes increases the H to 0.97. Does this reduce the average memory access time?

  Write program to prints the question

Write a program that prints the question"do you want to continue?" and reads a user input. if the user input is"y", "yes", "ok", "sure", or "why not?".

  Write non-abstract subclass constructor accepting double

Write (non-abstract) subclass, ApartmentHouse, containing: an int instance variable numberOfApartments. a constructor accepting a double, passed to superclass constructor, and an int used to initialize numberOfApartments

  Write the constructor function makestk

Write the constructor function makestk, predicate function emptystk and mutator functions pushstk and popstk

  Design program which ask the user for positive interger

Design a program which ask the user which application to do: after choosing from factorial or triangle(magicSquare), the program must then ask again the user for a positive interger.

  Why is it significant to use systems analysis

"Why is it significant to use systems analysis and design methodologies when building system? Why not just build system in whatever way seems to be quick and easy?

  Write pseudocode for determining grade of student

Write a pseudocode for determining the grade of a student given his/her total score. The program should display a grade of A if the score is above 85.

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