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

  Copy a multidimensional array

You have the following macro statements: #define WIDTH 5#define HEIGHT 3 You wish to copy a multidimensional array called anArray declared as follows:

  Explain the importance of pointers

Assuming an array has to be sorted, inserting a new element required shifting, in the worst case, n elements, where n is the number of elements in the array, i.e.:

  Using the following program as a guide

Using the following program as a guide, write a program reads in 2 scores in the main function.. Calls a function that will triple each number. In the function and the print the result in the main function.

  Write program to determine a car acceleration

Write C++ program to determine a car's acceleration written in 10 seconds

  Write a function named append that accepts three arguments

Write a function named append that accepts three arguments. The first two arguments passed to append are c-strings to be appended (the second c-string is appended to the first). The third argument passed should be the size of the character array ..

  Create a program that prompts a user for her name

A. Given a = 5, b = 1, x = 10, and y = 5, create a program that outputs the result of the formula f = (a b)(x y) using a single printf() function. B. Create a program that uses the same formula above to output the result; this time.

  C programs hat print out the max, min, and the average value

Write three C programs that print out the max, min, and the average values of the data file included below. Be sure to include the outputs of the programs in your solutions. Use three data file structures (counter, sentinel, and neither counter/senti..

  C++ program for food purchases at the baseball stadium

Write a menu-driven C++ program for food purchases at the baseball stadium's restaurant. The main program will loop allowing the user to select food items from the menu adding each item to the bill, terminating when the user selects the "End order" i..

  Generic binary tree using java generics

In this project you will create a generic binary tree using Java Generics.

  Where can grep be found for windows for linux

What is grep? Where can grep be found for Windows? For Linux?

  Define a function named average grade

Define a function named average grade. This function returns a double and has four double arguments, testi, test2, test3, test4. The return value should be the average, or arithmetic mean of the four arguments.

  Classes and objects are the basic concepts of

question 1. list three debugging techniques within the debugger that can be used to locate logical error in the java

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