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

  Number of new entries of parts in the application

The application should be able to count the number of automobile parts sold every week depending upon the number of new entries of parts in the application. If a part is not sold for more than six months after its date of manufacture, the applicat..

  Struct complex

A complex number can be represented by two parts, real and image. A series complex data can be organized as a group of elements by linked list, which is shown as below: struct Complex

  Write a program to print out 30 real random numbers

Write a program to print out 30 Real Random Numbers with specific limitation (e.g. the real random numbers should be the real number between min=11.1 to  max=222.2).

  Estimated number of copies that will be sold

Write a program that prompts the author to enter the net price of each copy of the novel and the estimated number of copies that will be sold.

  Program that reads in the average monthly

Write a program that reads in the average monthly rainfall for a city for each month of the year and then reads in the actual monthly rainfall for each of the previous 12 months. The program then prints out a nicely formatted table showing the rainfa..

  A real-life plc programming task

In lieu of a final exam, you are required to complete a final, capstone project for this course. The final project ties together everything covered in the course and offers you the opportunity to apply what you have learned to a real-life PLC program..

  Program to check compatibity for matrix multiplication

Write down program in C++ for matrix multiplication. Program must accept dimension of both matrices to be multiplied and check for compatibity.

  Create an array of 12 structures to hold weather of yearl

Input validation: only accept temperatures within the range between -100 and +140 degrees Fahrenheit.

  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..

  Program to next the loops in either direction

You can write your program to next the loops in either direction, that is, process row-by-row or column-by-column. Explain which way you would choose to process the data.

  Interface that manages scores from surfing contest

Create a program with a menu driven interface that manages the scores from a surfing contest. At start up, your program should read the attached file, pick the score out of each line and append it to a list of scores.

  Write program which reads n numbers from keyboard

Write down C++ program which reads N numbers (positive, negative, integer and double numbers) from keyboard, computes and shows the following information. Largest number of all numbers entered from keyboard.

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