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

  Program for class quiz to implement measurable interface

State a class Quiz to implement Measurable interface. A quiz has a score and a letter grade (such as B+).

  Create a simple shell

Create a simple shell. Basically your shell should read the line from standard input, parse the line with command and arguments, and operate the command with arguments.

  Payroll program for a company

Write complete PAYROLL program for a company in which each employee falls into one of 3 categories - Administrative, Factory Employee or Salesperson.

  Write a program to enter series of numbers

Write a program that ask the user to enter a series of numbers ending with -1. After the -1 is input, program should print how many numbers are even and how many numbers are odd.

  C program to accept three numbers inputs by user

Write down C program to accept three numbers input by a user, and outputs a table of temperatures in Fahrenheit, Celsius, and Kelvin.

  Program to prompts user for integer and print prime number

Give a program which will compile in VS 2010. Write a program to prompts user for integer and then prints out all prime numbers up to that integer.

  Build a student record managing system application

Build a student record managing system application

  Formula translation

Write a c code that will evaluate the roots of a quadratic equation

  Function to convert a decimal input into roman numerals

Write a function that converts a decimal input into Roman Numerals. Your function will take in a number and output a string.

  Find largest number in array

Find the largest number in the array and output the result. use a subprogram to input the numbers, a function to use the largest number.

  Computing first seven values of fibonacci number sequence

Write a program that uses a loop to compute the first seven values of the Fibonacci number sequence.

  Program that uses for loop prompt user to input two integers

Write a program that uses for loop to preform the following steps: Prompt the user to input two integers: firstnum and secondnum.

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