Create a base shape use this class to store two double

Assignment Help C/C++ Programming
Reference no: EM131097602

Program

Create a base shape. Use this class to store two double type values that could be used to compute the area of figures. Derive two specific classes called triangle and rectangle from the base shape. Add to the base class, a member function get_data() to initialize base class data members and another member function display_area() to compute and display the area of figures. Make display_area() as a virtual function and redefine this function in the derived classes to suit their requirements. 

Using these three classes, design a program that will accept dimensions of a triangle or a rectangle interactively and display the area. 

Remember the two values given as input will be treated as lengths of two sides in the case of rectangles and as base and height in the case of triangles and used as follows:

Area of rectangle = x* y
Area of triangle = ½ * x * y

Reference no: EM131097602

Questions Cloud

Marginal cost associated with producing in the two plants : You are the manager of a firm that produces output in two plants. The demand for your firm's product is P = 80-Q, where Q = Q1 + Q2. The marginal cost associated with producing in the two plants are MC1 = Q1 and MC2 = 8. How much output should be pro..
Different from the one facing firm in perfect competition : The monopolist’s marginal revenue is different from the one facing a firm in perfect competition because: (a) The price elasticity he faces is less than unity; (b) The price elasticity he faces is equal to unity; (c) The price elasticity he faces is ..
Increase in equilibrium level of national income : In an economy, the marginal propensity to consume is 0.8. The government balances the budget by adjusting the proportional tax level to the required government spending. An increase by 10 million in government required spending will lead to an increa..
Inflation and expectations are rational-longrun equilibrium : When there are expectations that there will be inflation and expectations are rational, the longrun equilibrium will be:
Create a base shape use this class to store two double : Create a base shape. Use this class to store two double type values that could be used to compute the area of figures. Derive two specific classes called triangle and rectangle from the base shape. Add to the base class, a member function get_data() ..
Fixed exchange rate regime : There is a fixed exchange rate regime. Assuming that all accounts are balanced in the balance of payments, a sale of a local enterprise to a foreign buyer will create:
Why is the behavior of an oligopolist so hard to predict : Why is the behavior of an oligopolist so hard to predict? How does it differ from that of a monopolist? Why? Also, If a monopolist has little substantial competition wouldn’t logic dictate that that there would be a portion of the Marginal revenue cu..
Money supply and interest rate related to investment : Was monetary policy (money supply and interest rate related to investment) part of John Maynard Keynes's principles and theories that he advocated? Or did he only contribute to fiscal policy (government spending and tax rates)?
Advances in eradicating extreme hunger and poverty : Why does Dupont Corporation fund this effort which has no direct benefit to its profit margin? WILMINGTON, Del., May 20, 2014 – Today, the DuPont Advisory Committee on Agricultural Innovation & Productivity issued an updated progress reporton the glo..

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Savingsaccount objects and two checkingaccount objects

Develop a polymorphic banking application using the Account hierarchy you created. Create the following two SavingsAccount objects and two CheckingAccount objects and store them in an array called "arrays" of Account references to the objects

  Create a data file called friends.dat

Create a data file called friends.dat using any text-based editor and enter at least three records storing your friends' first and last names. Make sure that each field in the record is separated by a white space.

  Find the moment of inertia

Display a brief description of the program and ask the user to specify the type of loading (end load, intermediate load, uniform load)

  What is the :: called in c++

What is the :: called in C++ when used like this std::endl; In my main file, what line of code prevents me from having to put std before every endl

  Program to declare variables in c

What is the value of the following (Boolean) expression?

  Determine the letter grade associated with the average

Create a loop structure to display and calculate the factorial of the larger number provided by the user - What if these were test scores? Calculate the average of the two numbers provided.

  Design a program that asks for the number of fat grams

Starting out with Programming logic and design 3rd Author Tony Gaddis - Pg 279, PE 3 Fat Grams Calculator

  To overload a member function of the base class

To overload a member function of the base class A: the name of the function and the formal parameter list of the corresponding function in the derived class must be the same. B: the name of the function must be different

  Wave steepness is the ratio of wave height

Wave steepness is the ratio of wave height (WH) to wave length(WL) and is an indicator of wave stability. When wave steepness exceeds a 1/7 ratio; the wave becomes unstable and begins to break. Assume a data file exits with the following header

  Explain how to represent a lagged fibonacci generator

Explain how to represent a lagged Fibonacci generator using list abstract data types. What representation would be the most appropriate?

  Program which opens a data file and displays its content

writing a C++ program which opens a data file and then displays its contents with line numbers. That is the program should display the number 1 and then the first line of the file, then the number 2 and the second line of the file, etc.

  Write a function - greatest common divisor

Write a function named "g_c_d" that takes two positive integer arguments and returns as its value the greatest common divisor of those two integers.

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