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

  Write the cpp code for controversial issue of global warming

Write the C++ code for controversial issue of global warming has been widely publicized by the film An Inconvenient Truth, featuring former Vice President Al Gore.

  Write a program to evaluate infix expressions

Write a program to evaluate infix expressions. An infix expression looks like the following:   9 * (5 - 4) + 2 / 6

  Presented a number of recurrence relations

For this problem set, you will be presented a number of recurrence relations and asked to state their actual time complexity, showing your work in the process.

  Prepare a a simple class fraction

Web tickets are purchased on the internet. Web tickets purchased a week in advance of the event are £30 and those purchased less than a week in advance are £40.

  Print out the sum of all numbers, the average

Write a program that reads in a list of integer numbers and print out the sum of all numbers, the average, the lowest and the highest value entered. The first input number indicates how many numbers the program is attempting to read

  Write a program that convert fahrenheit to degrees celsius

Write a program that will convert Degrees Fahrenheit to Degrees Celsius.

  Derive class weekday from class datetime

We can retrieve any one of the date-time structure member using strftime - Derive class WeekDay from class DateTime such that WeekDay::display() will display local date time using values from the parameters and the corresponding weekday.

  Write a c++ function that removes and counts all occurrences

Write a C++ function that removes and counts all occurrences of a given string from such a bag. Your function should return this number.

  Write a function named fact

Write a function named "fact" that takes one integer arguments,call them "num" and returns as its values the factorial number

  Transformations of the graphic objects

The second project builds on the first project by adding the ability to specify transformations of some of the graphic objects. The specification for those objects now will require less information about their position and size because both will b..

  Set of integer numbers and another single number

Write an algorithm called locate (with running time log n, that accept a set of integer numbers and another single number and finds out whether the number is found in the set of integers. If it exist, it should print its index in the list otherwis..

  Write specifications for a method

Write specifications for a method that advances any given date by one day. Include a statement of purpose, pre- and post-conditions, and a description of the parameters.

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