Create a contructor with default parameters

Assignment Help Programming Languages
Reference no: EM131137839

Create a class called Box which has private data members: length and width, both float area, found from length and width name which is a dynamic string constructor

1) create a contructor with default parameters of 1 for length and width.

2) the constructor should calculate ther area member frm length and width.

3) add a static member called total_area.In the constructor,add the area of the box created toi total_area variable.

4) add a comment with cout<<creating a box using the name data member. member function create a member function called perimeter() which finds the perimeter of a box,and returns this value. p=2(L+W) WHERE p=perimeter, L=length , W=width Non-member function create a non member friend function called fits.this function takes 2 boxes as arguments(pass b reference) and returns true if the first box would fit inside the second box , else return false. one way to tell if box A fits in box B is if the length of A< length of B and width of A<width of NB destructor create destructor the iutputs a message deleting a box usig its name member in main(); instaniate 3 boxes with the constructor using code: Box b1("first",2,3); Box b1("second",5); Box b1("third"); use the perimeter function for one of the boxes use the fits function for anty two of the boxes casll the function froom main() something like if(fits(b1.b2)) cout<<"box fits\n"; else cout<<"box doesn't fit\n"; when program finishs print out total area of the 3 boxes from this variable.

Reference no: EM131137839

Questions Cloud

If price of a good is set higher than equilibrium price is : If the price of a good is set higher than the equilibrium price: - Suppose that quantity supplied of a product equals 5 and quantity demanded equals 8. In this market, there is a:
The critical region of the likelihood ratio test : The number of successes in n trials is to be used to test the null hypothesis that the parameter θ of a binomial population equals 1/2 against the alternative that it does not equal 1/2.
Write commands to solve the system of equations : Write MATLAB commands to solve the system of equations. 7x-14y=95 -5x+9z=-50 -5x+15z=145
Compute the break-even point in dollars : Scottsdale Ltd.  has the following cost information available for various months of production: Compute the break-even point in dollars
Create a contructor with default parameters : Create a class called Box which has private data members: length and width, both float area, found from length and width name which is a dynamic string constructor
The effects of fluctuating groundwater levels : Interpret and discuss these plots with respect to the effects of fluctuating groundwater levels.
Effect do the closing costs have on the effective a i r : If the loan in Problem 22 is paid off at the end of the thirtieth month (at the time of the 30th payment) what effect does this have on the effective annual interest rate?
An example of a normative question : Which is an example of a normative question? - What are the long-term effects of unemployment? - How do interest rates influence employment?
Calculate the hydraulic conductivity : Estimate the hydraulic conductivity of a similar soil with a porosity of 35% from the results of this test.

Reviews

Write a Review

Programming Languages Questions & Answers

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

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