Preview

Pm3110 Unit 5 Lab Report

Good Essays
Open Document
Open Document
343 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Pm3110 Unit 5 Lab Report
//Ex7_02.cpp
//Creating and using boxes
#include <iostream> using std::cout; using std::endl;

class CBox //Class definition
{
Public: double m_Length; //Length of box in inches double m_Width; //Width of box in inches double m_Height; //Height of box in inches

//Function to calculate volume of boxes double Volume(); { Return m_Length*m_Width*m_Height; }
};

int main()
{
CBox box1; //Declare box 1 of type CBox CBox box2; //Declare box 2 of type CBox CBox box3; //Declare box 3 of type CBox

double boxVolume=0.0; //Stores box volume

box1.m_Height=18.0; //Define values box1.m_Length=78.0; //of of the members of box1.m_Width=24.0; //the object box1

box2.m_Height= box1.m_Height-10; //Define
…show more content…
Under what circumstances must you use classes?

Classes are useful for length programs which require large amounts of similar code. Classes can accelerate program development by reducing redundant code, testing, and debugging. Using classes also makes the code easier to read and follow for other programmers.

Why do you use a class instead of a structure? Are they interchangeable? Explain your answer.

The main difference between a class and a structure in C++ is that structs have default pblic members and basses and classes have default private members and bases. Classes and structs can contain a mixture of public and private members, use inheritance, and can have member functions. For the most part classes and structs are interchangeable, however, there are some instances where they are not which could lead to a compiling error.

Are classes more useful than structures? Why?

Although classes and structures are very similar classes are more useful because with a structure each variable is permanently bound to an individual instance where as classes are reference types which can refer to various class instances.

RUN

You May Also Find These Documents Helpful

  • Satisfactory Essays

    Uu100 Unit 9 Lab Report

    • 261 Words
    • 2 Pages

    The relationship between an active application and the taskbar is that, the taskbar is used to displays the programs that are currently running and also other open windows that shows various information including programmes currently running. Whereas the active application is the actual running programs which are show…

    • 261 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Functional structure and simple structure are the most common forms of structure. Small companies use them forms of structure. With the smaller companies, most employees report straight to the owner of the company because there are not any other managers or supervisors. Both of these structures are good for businesses that are just starting or small.…

    • 745 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    To be a good programmer you have to be organized and do a lot of thinking when it comes to structures and getting the correct…

    • 605 Words
    • 3 Pages
    Good Essays
  • Better Essays

    American History X

    • 1188 Words
    • 4 Pages

    Structure was a way for Gidden to study social practices. Structure is defined as “rules and resources that we draw on to produce and reproduce society or social systems through our practices.” (Erickson, 2014: Class notes) Practices are “things people regularly do.” (Erickson, 2014: Class notes) This could be waking up for work or going to class everyday. Whenever someone draws on a practice they are drawing on rules and resources. Rules are “norms that we follow or…

    • 1188 Words
    • 4 Pages
    Better Essays
  • Good Essays

    Sociological Theories

    • 678 Words
    • 3 Pages

    Social structure is a term frequently used in sociology and social theory — yet rarely defined or clearly conceptualized. In a general sense, the term can refer two; entities or groups in definite relation to each other; relatively enduring patterns of behavior and relationship within a society, or social institutions and norms becoming embedded into social systems in such a way that they shape the behavior of actors within those social systems.…

    • 678 Words
    • 3 Pages
    Good Essays
  • Good Essays

    Every organization, to be effective, must have a structure. An organization structure is the setup that determines the hierarchy and reporting structure in an organization.…

    • 659 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    Sociology 101 Midterm

    • 472 Words
    • 2 Pages

    Social structure are the physical things, and social constructions are the set of ideas. An example of this would be laws. Under social construction the law becomes the behaviors that are inforced for society, on the other hand social structure is where the laws come from and are created.…

    • 472 Words
    • 2 Pages
    Satisfactory Essays
  • Better Essays

    Any object has its structure. As the noun “structure” is rendered as “строение, расположение, порядок”, structure is defined as functional interdependence of elements constituting the carcass of an object.…

    • 6275 Words
    • 26 Pages
    Better Essays
  • Good Essays

    orient train station

    • 308 Words
    • 1 Page

    Structure is one of the most essential elements in the development of an architectural form. There needs to be the right amount of tension, compression, and all of the gravitational forces have to equal to zero. Tension is the act of stretching or the state or degree of being stretched and compression is a force squashing, squeezing, or pressing down on an object. Gravitational force is the force due to gravity.…

    • 308 Words
    • 1 Page
    Good Essays
  • Satisfactory Essays

    Avl Tree

    • 324 Words
    • 2 Pages

    //NAME: MANGUERRA JR, WILLIAM E. //INSTRUCTOR: RUBY GLIPONEO //YEAR AND SECTION: II-CpE 1 # include # include # include using namespace std; struct node { int element; node *left;…

    • 324 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    (I have taught you how to write the Calculation Class – “black box” concept. Encapsulation, Polymorphism)…

    • 280 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Microscopy

    • 406 Words
    • 8 Pages

    Microscopy Cell are very Small     Metabolic requirements set upper limits on the size of cells The surface area to volume ratio of a cell is critical As the surface area increases by a factor of n2, the volume increases by a factor of n3 Small cells have a greater surface area relative to volume Figure 6.7 Surface area increases while total volume remains constant 5 1 1 Total surface area [sum of the surface areas (height  width) of all box sides  number of boxes] 6 150 750 Total volume [height  width  length  number of boxes] 1 125 125 Surface-to-volume (S-to-V) ratio [surface area  volume] 6 1.2 6 Microscopy  Scientists use microscopes to visualize cells – too small to see with the naked eye …

    • 406 Words
    • 8 Pages
    Satisfactory Essays
  • Satisfactory Essays

    • Structure refers to the arrangements of persons while organization refers to the arrangement of activities…

    • 545 Words
    • 3 Pages
    Satisfactory Essays
  • Powerful Essays

    A class can have subclasses that can inherit all or some of the characteristics of the class. In…

    • 778 Words
    • 5 Pages
    Powerful Essays
  • Better Essays

    Structure in Lit Novels

    • 1191 Words
    • 5 Pages

    STRUCTURE refers to shape. Writers shape the texts they create by fitting characters, places and events into a story which is satisfying and complete. Structural framework, on which the details of the text are hung, develops the sense the reader regarding how complex details fit into a shaped whole, and so tells you more about the meaning and purpose of the work.…

    • 1191 Words
    • 5 Pages
    Better Essays

Related Topics