Homework 3: Class ID Solution

$30.00 $24.00

Educational Objectives. After successfully completing this = assignment,=20 the student should be able to accomplish the following: Design a class based on non-language-specific specifications=20 Implement a class of your own design=20 Implement constructors, copy constructor, destructor, and = assignment=20 operator for a class that has resource allocation requirements=20 Implement Set and Get methods for class…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Description

5/5 – (2 votes)

Educational Objectives. After successfully completing this = assignment,=20 the student should be able to accomplish the following:

  • Design a class based on non-language-specific specifications=20

  • Implement a class of your own design=20

  • Implement constructors, copy constructor, destructor, and = assignment=20 operator for a class that has resource allocation requirements=20

  • Implement Set and Get methods for class data=20

  • Correctly separate class definition and implementation using files =

  • Create executables of class client programs using makefiles and = the Make=20 utility=20

  • Test a class using specs and an existing test platform

Operational Objectives: Define and implement the = class=20 ID and deliver the code in two files id.h and = id.cpp=20 along with a makefile for the supplied test harness.

Deliverables: id.h, id.cpp,=20 makefile

Background

See lecture notes

Procedural Requirements:

  1. Design the class ID

  2. Implement the class ID with the class definition in file = id.h and=20 the class implementation in file id.cpp

  3. Thoroughly test class ID, starting out with the supplied test = harness in=20 file hw3/test.cpp using command line compile

  4. Write a makefile that builds test.x with the “in lieu of = makefile”=20 include statement commented out or removed

  5. Test the executable again, and refine your work to withstand = testing.

  6. Turn in id.h, id.cpp, and makefile using = the=20 hw3submit.sh submit script.

Warning: Submit scripts do not work on the = program and=20 linprog servers. Use shell.cs.fsu.edu to submit = projects. If=20 you do not receive the second confirmation with the contents of your = project,=20 there has been a malfunction.

Technical Requirements and Specifications

  1. The class should implement the following diagram:=20

    Class Name:

      ID

    Services :

      void        SetName ( const char* ) // sets the name =
    field
      void        SetAge  ( int )         // sets the age field
      const char* GetName () const        // returns a const pointer to the =
    name field
      int         GetAge  () const        // returns the age field by value

    Properties :

      Constructable: objects can be declared as ordinary =
    variables
      Assignable:    objects can be assigned one to another
      Passable:      objects can be passed by value to and returned as =
    values from functions

    Private variables:

      char * name_  // the name field
      int    age_   // the age field
  2. The class should be a proper type, to include default constructor,=20 2-argument constructor (that initializes the two data fields), copy=20 constructor, assignment operator, and destructor.

  3. The output operator operator<< should be overloaded = for the=20 type ID.

  4. Class ID should pass testing with the supplied = hw3/test.cpp with=20 no compile or runtime errors and no compiler warnings when the warning = flags=20 -W, -Wall, -Wextra are set.

  5. Building and running the supplied hw3/test.cpp should = result in=20 output identical to the supplied executable area51/IDtest_?.x = [? =3D=20 i or s] .

Homework 3: Class ID Solution
$30.00 $24.00