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

  Calculate monthly payment and amortization schedule for loan

Write a C program that calculates the monthly payment and amortization schedule for the loan. The program should prompt the user to enter the loan amount, the annual interest rate, and the number of years the loan will run.

  You will write a program that reads a text file

You will write a program that reads a text file, counts the number of words in the file, and the number of occurrences of each character. It will print to a file the number of words, and the number of occurrences of each character, as well as the ..

  Useful and well-designed programs of ticketseller

Designing well-written and readable programs using a disciplined coding style, including documentation and indentation standards.Demonstrating how to implement logic involving sequence, selection, and repetition using Visual Basic.

  Implementation of matrix multiplication

Show the matrix product and implementation of matrix multiplication. Please show me all the working and provide the answer.

  Write a switch-case statement

Create a script named 'descent.m'. Give a brief but concrete example when switch?case statements should be preferred to if? elseif statements. Use block comments to enter your answer in the script.

  Implement the appropriate methods for big numbers

You must implement each big number as a List of single digits and you must also set up the template class List based on a linked list (use the sample codes). You will need to define and implement the appropriate methods for big numbers.

  Write the code that will display only even or odd numbered

Write the code that will display only the even or odd numbered elements within the array. The output should appear as follows: PRINTING CONTENTS OF ARRAY USING THE MOD Option

  Define an auxiliary procedure

How to use do to define (minimum lst) which returns the minimum of a list of numbers. You may want to define an auxiliary procedure (smaller x y), using if, which returns the smaller of the two numbers.

  Syntax for structures in c

How is the syntax for a class in C++ similar to the syntax for structures in C? Use this syntax to create your own programmer-defined class

  Books with suitable members

Design a system using a class called Books with suitable members

  Write and test c program which outputs waveform

Write and test a C program which outputs waveform which switches from 10.0 kHz with a 50% duty cycle to 25.0 kHz with a 5% duty cycle every 5 seconds.

  Declare and initialize an appropriate variable

Show the source code for a C# console application names ‘Sibs' that prints your frist name on the first line, your last name on the second line, and the number of siblings you have on the third line Declare and initialize an appropriate variable fo..

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