CSc 346 Assignment #6

$30.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (2 votes)

Use Visual Studio 2015 Enterprise Edition to create a user-defined Abstract Data Type (ADT) using C++
classes named Character and Warrior as discussed in class.
• The Character class describes the current state of a generalized game Character class instance.
• The Warrior class describes the current state of specialized game Character class instance.
• The Character and Warrior classes define the CharacterNS namespace.
o The Character and Warrior classes do not use this namespace.
UML diagram shows (UML Standard version shown):
• user-defined data type definitions
• user-defined data type relationships
o generalization-specialization relationships
▪ inheritance relationships
o colors indicate which class each enumeration is defined within
• visibility (access specifies): + public # protected – private
UML diagram does not show (UML Standard version shown):
• user-defined data type relationships form an “IS-A” relationship between base class and derived classes
o a derived class “IS-A” base class
o a base class “IS-NOT-A” derived class
• non-static (instance) methods
o constructors, destructors, standard methods, overloaded operators
• default values: arguments, attributes, …
• use of the const keyword: functions, arguments, …
• attribute initialization: initialize all attributes everywhere possible
o takes precedence over function reuse
• function reuse: reuse functions everywhere possible
o may need to be used to support attribute initialization
• function inlining implementation: explicit, implicit
The Character/Warrior ADT must define and implement the following data types and operations.
• Do not add to or modify the public interface (exportable components – public components).
• Do not add to or modify any attributes or data types (storage components).
Character class Exportable Operations: (declared .h file and defined .cpp file)
Character default/overloaded/parameterized constructor (*) (~)
class, name (Frodo), gender, life force (150)
Character copy constructor – creates an exact copy of an existing Character class instance (*) (~)
~Character destructor – displays the message: Character class instance destroyed
setters each attribute is supported by an appropriate standard setter method (^)
getters each attribute is supported by an appropriate standard getter method (^)
operator= assigns state of a Character class instance to invoking Character class instance (~)
operator<< displays the state of a Character class instance (~) Character class User-Defined Data Types: Class HUNTER, WARRIOR, WIZARD // default is bolded Gender FEMALE, MALE // default is bolded Warrior class Exportable Operations: (declared .h file and defined .cpp file) Warrior default/overloaded/parameterized constructors (*) (~) – MUST NOT repeat Character class default argument values – 1 version per argument combination – name, gender, life force – default argument values used with the additional Warrior attributes resistance (25), weapon Warrior copy constructor – creates an exact copy of an existing class instance (*) (~) – Character class & Warrior class instance versions ~Warrior destructor – displays the message: Warrior class instance destroyed setters each attribute is supported by an appropriate standard setter method (^) getters each attribute is supported by an appropriate standard getter method (^) operator= assigns state of a class instance to invoking class instance (~) – Character class & Warrior class instance versions operator<< displays the state of a Warrior class instance (~) Warrior class User-Define Data Types: Weapon AXE, SWORD // default is bolded Notes: (*) all attributes are initialized – PITA (~) each class is responsible for handling its own data base class subobject – derived class subobject (^) explicit inlining – all other methods defined and declared traditionally (^) Naming _class getClass setClass // drop the _ operator<< Required Output Format: Class: Hunter Class: Warrior Class: Warrior Name: Frodo Name: Zena Name: Link Gender: Male Gender: Female Gender: Male Life Force: 150 Life Force: 175 Life Force: 200 Resistance: 25 Resistance: 55 Weapon: Axe Weapon: Sword Make sure to completely document the header/implementation files. • The header (.h) file tells the user exactly how to use your ADT o General descriptions only – do not include implementation details • The implementation file (.cpp) tells the implementer/programmer exactly how the ADT works o Detailed descriptions – include implementation details Add appropriate guards to prevent multiple inclusions of the individual ADT modules. The Character/Warrior ADT exists entirely within the CharacterNS namespace. • “Using Directive” to access the CharacterNS namespace members. • “Using Directive” to access the std namespace members: cin, cout, endl, etc… I will write a test program that will include your Character/Warrior ADT so all header/implementation files tested must use common names. So you MUST use: • the EXACT same names for each data type and function in the header/implementation files. • the EXACT same function argument sequence in the header/implementation files. Zip together and e-mail your Solution/Project Folder using the following naming convention. Archive Name: Lastname6.zip or Lastname6.7z // I would use Gamradt6.zip Solution/Project Folders: Lastname6 // I would use Gamradt6 • Character.h Character class header file • Character.cpp Character class implementation file • Warrior.h Warrior class header file • Warrior.cpp Warrior class implementation file • main.cpp driver program file // I will use my own List the class number, your last name, and assignment number as the e-mail message subject: SUBJECT: csc346 – gamradt – a6 // I would use Character/Warrior ADT include sequence with multiple modules: // Never include .cpp files Character.h Character.cpp main.cpp Warrior.h Warrior.cpp Creating Character/Warrior ADT Solution/Project settings: 1. New Project 2. Visual C++ – Win32 – Win32 Console Application 3. Name: 6 – Create directory for solution (check) – OK
4. Next > // Do NOT click Finish
5. Console application (selected) – Empty project (check) – SDL checks (uncheck) – Finish
Preparing Solution/Project for submission:
• Clean the Solution: Build -> Clean Solution
• Remove Debug Folders: Solution Folder and Project Folder
• Remove Data Base File: Solution Folder – 6.vc.db