Write accessor funtions for height, width, and depth.

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

Given below is a c++ class called Sbox used in shipping.

We can declare an object of type Sbox to hold the dimensions of a shipping box, a height, width and depth. We define a height (h), width (w) and depth (d) for the three sides of a box. For shipping, it is required the height to be no greater than 45 inches. The width cannot be anymore than 75% of the box's height. The depth must be less than the height.

Class Sbox
{
Private:
Int h, w, d; // height width depth

1. Write a constructor function that
A) defines an object with default value of 0s
{
public:
Sbox ()
.............
};

Sbox::Sbox()
{ h=0; w=0; d=0;}

b) define an object with the initial values for h, w, and d. check for the constraints listed earlier
Sbox::Sbox (int h, int w, int d)
{
if (h<45 && (w<h* 0.75) && d<h)
{
this->h=h;
this->w=w;
this->d=d;
}
else {
this->h=0;
this->w=0;
this->d=0;
}

}

2. Write accessor funtions for height, width, and depth.
Also, what exactly is an accessor function?

Reference no: EM13936582

Questions Cloud

Field of public administration and nonprofit organizations : Purpose of the assignments is to introduce students to the field of public administration and nonprofit organizations by identifying and analyzing the challenges a public administrator faces in a dynamic organizational and politicial environment.
Calculate the total volume for all three boxes : Calculate the total volume for all three boxes in question.Add a third box to the calculation.
Create a database named sample.mdf : Register Table: (Refer to the sample screen shot but you have to include the other field mentioned in the requirement.) Your register table should have the following field:
Impact of geography on the conduct of war : Assess the impact of geography on the conduct of war. How was the geography of Northern Africa different from the previous military campaigns examined in this course and how did it impact Rommel's command decisions
Write accessor funtions for height, width, and depth. : Write accessor funtions for height, width, and depth.Also, what exactly is an accessor function?
Do you feel you should abide by the approval : You are a newly elected County Auditor. As part of your new position, you now control a 30 million dollar budget for the county. Before any claim can be submitted to the county commissioners for payment, it is your responsibility to review and app..
How has peony plant evloved to cover bud with waxy coating : How has the peony plant evloved to cover the bud with the waxy coating meaning how did it come to become this way? Why and how the evolution from a non-waxy coating (if this ever existed) to a waxy coating take place?
Using a for loop, print the contents of the array. : Write the code to update every other element within the array with a lowercase x.
How physical and chemical laws affect a living organism : Explain how physical and chemical laws affect a living organism. Explain ow an organism has evolved to adapt to its physical or chemical environment. Then answer: who do you think physical and chemical laws relate functions to structures and vice ..

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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