All of the work in this project is my own!  I have not left copies of my code in public folders on university computers. I have not given any of this project to others. I will not give any portion of this project to others taking this class. I realize that the penalty for turning in work that is not my own can range from an "F" in the class to dismissal from Trinity University. 

                                                                                             Print Name  __________________________

                                                                                              Signature   __________________________


   Quiz/In Class DellComputer Makefile Lab
Individual Assignment
  15  Points

All Labs, unless specified otherwise, are to be completed and brought to the next class period. The wire-band binders,
containing these labs, will be collected once a week; see the class schedule.


Set Margins [ Left = 1; Right =. 2; Top =. 4; Bottom = .4; Select Document Title,  Page Number, Page, Black Text, Black Lines]

ADT is an acronym for ___________________________________________

Stack is a {LIFO/FIFO}  ______________________________ structure/ADT.

Queue a {LIFO/FIFO}  ______________________________ structure/ADT.

LIFO is an acronym for ___________________________________________

FIFO is an acronym for ___________________________________________

A Function Which Calls Itself is {Iterative/Recursive} _____________________

The Three Requirements Of Recursive Functions Are .................................

      (1) _________________________________________________

      (2) _________________________________________________

      (3) _________________________________________________

Three Primitive Operations On The Stack Are ________________________

The Primitive Operation For Placing Elements In A Stack is called __________

The Primitive Operation For Removing Elements From A Stack is called _____

The Primitive Operation For Determining If A Stack Is Empty is called ______

Three Primitive Operations On The Stack Are _______________________

The Three Categories Of Items Pushed To A Stack During Recursive Functions Are

      (1) __________________________________________________

      (2) _________________________________________________

      (3) _________________________________________________

 


Record reasons why we partition a program into .hpp and .cpp files.
 [also could be done in .h and .c]  [also could be done in .h and .cpp]

________________________________________________________________

________________________________________________________________

________________________________________________________________

________________________________________________________________


What Goes Into the Class .hpp File?

________________________________________________________________

________________________________________________________________

________________________________________________________________

________________________________________________________________


What Goes Into the Class .cpp File?

________________________________________________________________

________________________________________________________________

________________________________________________________________

________________________________________________________________


What is the function of the lines and where are they placed within the code?

# ifndef PART_TYPE // ==============================================

# define PART_TYPE

 

 

# endif // PART_TYPE ===============================================

________________________________________________________________

________________________________________________________________

________________________________________________________________

________________________________________________________________


1] Include the following Main.cpp  file:
 

//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//                                                                              //
//                                Main.cpp                                      //
//                                                                              //
//  Purpose    : Evoke The Test Module for class Part.                          //
//                                                                              //
//  Written By : Dr. Thomas E. Hicks                  Environment : Windows NT  //
//  Date       : 8/22/00                              Compiler    : Visual C++  //
//                                                                              //
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////

// ------------------------------- Includes --------------------------------------
# include <iostream.h>
# include "Part.hpp"

// ------------------------------- Defines ---------------------------------------

main (int argc, char * argv[])
{
   cout << "--------------------- Start Of Main -----------------------\n";
   cout << "---------------- Dell Computer Lab/Quiz -------------------\n";
   cout << "----------------------- Created By ------------------------\n";
   cout << "----------------------- ?????????? ------------------------\n\n\n";
   TestPart();
   cout << "----------------------- End Of Main ----------------------\n";
   return (0);
}

2] Include the following Part.hpp file:
 

//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//                                                                              //
//                                 Part.hpp                                     //
//                                                                              //
//  Purpose    : House includes, defines, class definitions, function           //
//               prototypes, and all template methods.                          //
//                                                                              //
//  Written By : Dr. Thomas E. Hicks                  Environment : Windows NT  //
//  Date       : 8/26/00                              Compiler    : Visual C++  //
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////

# ifndef PART_CLASS //============================================================

// ----------------------------------- Includes ----------------------------------
# include <iostream.h>
# include <iomanip.h>
# include <string.h>

// ----------------------------------- Defines -----------------------------------
# define PART_CLASS

//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//                                     Class Part                               //
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
class Part
{
public:
   Part (void);
   ~Part (void);
   void Display(void);
   void Display50(void);
   void Set(char NewName[], int NewNo);

private:
   char 
      Name [26];
   int
      No;
};

// ------------------------- Non-Class Functions Prototypes-----------------------
void TestPart(void);
 

# endif // PART_CLASS ============================================================

 

3] Include the following Part.cpp file:
 

//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
///                               Part.cpp                                      //
///                                                                             //
/// Purpose    : House all non-template methods for class Part.                 //
///              House function TestPart(void).                                 //
///                                                                             //
/// Written By : Dr. Thomas E. Hicks                  Environment : Windows NT  //
/// Date       : 8/26/00                              Compiler    : Visual C++  //
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////

///--------------------------- Includes ----------------------------------
# include "Part.hpp"
 

//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//                                 Method Part                                  //
//                                                                              //
// Purpose : Constructor Class Part. Initialize Name to blank and No to 0.      //
//                                                                              //
// Written By : Dr. Thomas E. Hicks                   Environment : Windows NT  //
// Date       : 8/26/00                               Compiler    : Visual C++  //
//                                                                              //
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
Part::Part (void)
{
    cout << "Evoking Constructor Part(void)" << endl;
    No = 0;
    strcpy (Name, "");
}

//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//                                 Method ~Part                                 //
//                                                                              //
// Purpose : Destructor Class Part.                                             //
//                                                                              //
// Written By : Dr. Thomas E. Hicks                   Environment : Windows NT  //
// Date       : 8/26/00                               Compiler    : Visual C++  //
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
Part::~Part (void)
{
   cout << "Evoking Destructor Part(void)" << endl;
}

//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//                                 Method Display                               //
//                                                                              //
// Purpose : Display Name on line 1, No on line 2, and blank on line 3.         //
//                                                                              //
// Written By : Dr. Thomas E. Hicks                   Environment : Windows NT  //
// Date       : 8/26/00                               Compiler    : Visual C++  //
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
void Part::Display(void)
{
   cout << "Name : " << Name << endl;
   cout << "No   : " << No << endl << endl;
}
 

//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//                                 Method Display50                             //
//                                                                              //
// Purpose : Display the most important 50 characters of the structure.         //
//           No line feed.                                                      //
//                                                                              //
// Written By : Dr. Thomas E. Hicks                   Environment : Windows NT  //
// Date       : 8/26/00                               Compiler    : Visual C++  //
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
void Part::Display50(void)
{
   cout << setw(40) << Name << "  " << setw(8) << No;
}
 

//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//                                 Method Set                                   //
//                                                                              //
//Purpose : Set the value of Name to NewName. Set the value of No to NewNo.     //
//                                                                              //
// Written By : Dr. Thomas E. Hicks                   Environment : Windows NT  //
// Date       : 8/26/00                               Compiler    : Visual C++  //
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
void Part::Set(char NewName[], int NewNo)
{
   strcpy (Name, NewName);
   No = NewNo;
}
 

//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//                                 Function TestPart                            //
//                                                                              //
//Purpose : Test each and every method in class Part.                           //
//                                                                              //
// Written By : Dr. Thomas E. Hicks                   Environment : Windows NT  //
// Date       : 8/26/00                               Compiler    : Visual C++  //
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
void TestPart(void)
{
   cout << "------------- Beginning of Procedure Test--------------------\n";
   cout << "************* Testing Constructor - Delcalre 1 Part\n";

Part
   Part1,
   Parts[4];                  

   cout << "\n************* Testing Display Method [verifies constructor init]\n";
   Part1.Display();

   cout << "\n************* Testing Set Method\n";
   Part1.Set("Basketball", 22);
   Part1.Display();

   cout << "\n*************  Display50 by boxing in the informatin\n\n";

   cout << "| 12345678901234567890123456789012345678901234567890 |\n";
   cout << "-------------------------------------------------------\n";
   cout << "| ";
   Part1.Display50();
   cout << " |\n";
   cout << "-------------------------------------------------------\n";
   cout << "\n*************  Testing Constructor - Delcalre An Array of 4 Parts\n";

   cout << "\n*************  The destructor will be called 5 times when exiting\n";
   cout << "----------------- End of Procedure Test--------------------\n";
}

//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//                                                                              //
//                          Output From TestPart                                //
//                                                                              //
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
/*
--------------------- Start Of Main ---------------------
----------------- Beginning of Procedure Test------------------------
************* Testing Constructor - Delcalre 1 Part
Evoking Constructor Part(void)

************* Testing Display Method [verifies constructor init]
Name : 
No   : 0
 

************* Testing Set Method
Name : Basketball
No   : 22
 

*************  Display50 by boxing in the informatin

| 12345678901234567890123456789012345678901234567890 |
-------------------------------------------------------
|                               Basketball        22 |
-------------------------------------------------------

*************  Testing Constructor - Delcalre An Array of 4 Parts
Evoking Constructor Part(void)
Evoking Constructor Part(void)
Evoking Constructor Part(void)
Evoking Constructor Part(void)

*************  The destructor will be called 5 times when exiting
----------------- End of Procedure Test------------------------
Evoking Destructor Part(void)
Evoking Destructor Part(void)
Evoking Destructor Part(void)
Evoking Destructor Part(void)
Evoking Destructor Part(void)
----------------------- End Of Main ----------------------
*/


 

4] Create a folder called DellMake. Copy files Main.cpp, Part.hpp, and Part.cpp from this lab or E-Mail into this folder DellMake.

5] Use Putty or Telnet to log on to one of the red hat systems [xenaxx.cs.trinity.edu, janusxx.cs.trinity.edu]. Use vi to create the following makefile: Note that the second lines of each set must be tabbed! (g++/rm lines)
 

Dell: Main.o Part.o
 g++ -o Dell Main.o Part.o

Part.o: Part.cpp Part.hpp
 g++ -c Part.cpp

Main.o: Main.cpp
 g++ -c Main.cpp

clean: 
   rm *.o Dell

6] Enter the following on the command line.

make Dell
ls -l
7] Write the names of all of the files, and their respective sizes, that now exit in your Dell folder on the Linux account.

------ File Name ----------------------------------   ---- No Bytes ---

Main.cpp
____________________________________________   ________________

____________________________________________   ________________

____________________________________________   ________________

____________________________________________   ________________

____________________________________________   ________________

____________________________________________   ________________

____________________________________________   ________________

____________________________________________   ________________

____________________________________________   ________________ 

8] Do the following when program is complete.

Dell > Output.txt <-- Runs the program and dumps output into file Output.txt

9] Use Visual C++ To Print the following: with Margins!
Makefile
Main.cpp
Part.hpp
Part.cpp
Output.txt



10] Those Labs labeled "Individual Assignment" are to be done separately by each individual. Using a pen,  each individual is to print  his/her name at the top of this document in the space provided and sign it.  Those Labs labeled "Team Assignment" may be done as a team or individually. Using a pen,  each individual on the team is to print print his/her name at the top of this document in the space provided and sign it. Submit only one copy of team assignments!

Include the following in your wire-band binder:

A] Divider

B] Copy of this assignment sheet. Using an ink pen, print your name and sign this lab at the top.

C] Listings  Makefile Main.cpp, Part.hpp, Part.cpp, Output.txt

D] Disk Containing  Makefile Main.cpp, Part.hpp, Part.cpp, Output.txt

E] Divider