Program to calculate area of two-dimensional shape

Assignment Help Programming Languages
Reference no: EM1361445

Implement the Shape hierarchy shown in following figure. 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: EM1361445

Questions Cloud

Determine costs that change in direct proportion : A method of attributing expenses to products based on assigning costs of resources to activities and assigning costs of activities to products is known as Unit Based Costing.
Calculate the minimum stopping distance of the car : Find out the magnitude of the wind velocity. Find the direction of the wind velocity.If the wind velocity is 39 due south, in what direction should the pilot set her course to travel due west? Use the same airspeed of 213 .
Write a program to model a simple calculator : Write a program to model a simple calculator. Each data line should consist of the next operation to be performed from the list below and the right operand.
The costs of maintaining current assets : The costs of maintaining current assets, including the opportunity cost of capital is known as, Expenses should be recorded in the period in which they are used up.
Program to calculate area of two-dimensional shape : Implement the Shape hierarchy shown in following figure. Each TwoDimensionalShape should contain method getArea to calculate the area of the two-dimensional shape.
Explain how does the price of fertilizer compare : Explain how does the price of fertilizer compare to the average total cost, the average variable cost, and the marginal cost of producing fertilizer.
Find the acceleration of the bucket : suppose that the springs have somehow not yet compressed to their maximum amount. How much are the springs compressed.
Calculate company margin of safety : Van Roekel Corporation sells a single product. The product has a selling price of $100 each unit and variable expenses of 80 percent of sales. If the company's fixed expenses total $150,000 each year,
Disease prevention strategies : Should healthcare organizations develop disease prevention strategies? Why or why not? Do you think ethically it is their responsibility?

Reviews

Write a Review

Programming Languages Questions & Answers

  Write function to take the name of file as one parameter

Write a function named paragraphStats() that takes one parameter:the name of a file. The file contains a single line of text.

  Creating form which analyzes poker hand entered by user

To observe behavior of Sub Procedures, draw a Form which analyzes a poker hand entered by user and displays the type of hand.

  Travelling salesman problem

Travelling Salesman Problem on the L1-metric plane.

  Program to compute person earns in a month

Write a program that calculates how much a person earns in a month if the salary is one penny the first day, two pennies the second day, four pennies the third day.

  Write a program that will generate an array

Write a program that will generate an array

  Program that asks for user-s age

Write a program that asks for user's age. Based on their response print "You can vote" (18 years old or older) or "You can't vote".

  Program to calculate integer part of quotient

Calculate the integer part of the quotient when integer a is divided by integer. Calculate the integer remainder when integer a is divided by integer b

  Identify all the pure-strategy nash equilibria of game

Identify all of the pure-strategy Nash Equilibria of this game. Identify at least one mixed-strategy Nash Equilibrium, and show that it is a Nash Equilibrium.

  Designing navigation system for point-and-click system

Design a navigation system or menu allows Access to act like point-and-click system. Write down some of the kinds of navigation.

  Explaining steps to execute branch instruction

Sketch a flow chart which carefully explains steps that little man follows to execute a branch instruction.

  Accuracy and completeness of computations

Analysis right and you have to develop a plausible argument to "prove" that your analysis is correct

  Design pseudocode to enter names of two primary colors

Design a pseudocode program that prompts the user to enter the names of two primary colors to mix. If the user enters anything other than "red", "blue", or "yellow".

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