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

  Create nested menus interface for a check-in hotel

Create a nested menus interface for a check-in and check-out hotel reservation system that can be used internationally. Use numbers to select a menu item.

  Php code to add-delete product using ajax programming

PHP Code to add a new product and delete a existing product Implement AJAX Programming based solutions to write code to add a new product to the database.

  Design a benefits election system

Individual project for this course is in form of Service Request from Huffman Trucking. It is essential for student to access Service Request: SR-ht-001. Design a Benefits Election System.

  Explaining tags used for effective page layout

Page layout is one of the most time consuming tasks for a web designer. What are some of the tags used for effective page layout and how do they work?

  Why small to medium sized firm implement pki solution

Why would a small to medium sized firm implement a PKI solution? What are the characteristics required in using a password that will provide security protection for a company?

  Create ajax-based product catalog

Create an AJAX-based product catalog which obtains its data from JSON files located on the server. The data should be separated into four JSON files.

  Write a method to accepts string as parameter

Write a method called wordCount that accepts a String as its parameter and returns the number of words in the String. A word is a sequence of one or more nonspace characters

  Program has function named presentvalue for calculations

Write a program that has a function named presentValue that performs this calculation. The function should accept the future value, annual interest rate, and number of years as arguments.

  Explaining graphics as user experience on web sites

Graphics provide significant richness to the user experience on web sites. Discuss how each of these sites uses graphics in good or poor ways.

  Development of the current strategic potential of airline

Evaluate the organisation's current external and internal strategic position

  Write a method that returns the value of base exponent

Write a method IntegerPower(base, exponent) that returns the value of base exponent For example, IntegerPower(3, 4) = 3 * 3 * 3 * 3.

  Unix systems administration

Unix Systems Administration

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