Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

HELP! C++ Programming Assignment. I am looking for some help on the second part of my programming assignment. I was able to complete assignment 1

HELP! C++ Programming Assignment. I am looking for some help on the second part of my programming assignment. I was able to complete assignment 1 and received full credit. My next assignment builds onto the first assignment, but I feel lost, I don't know where to start. Disclaimer: I posted this question twice by ACCIDENT. So if you saw it twice, please forgive me!!! Here is EmployeeRecord.h code:

#ifndef EMPLOYEERECORD_H #define EMPLOYEERECORD_H

class EmployeeRecord { private: int m_iEmployeeID; char m_sFirstName[32]; char m_sLastName[32]; int m_iDeptID; double m_dSalary;

public: EmployeeRecord(); //Constructor EmployeeRecord(int ID, char *fName, char *lName, int dept, double sal); //Setting the values. ~EmployeeRecord(); //Destructor int getID(); // Return the value stored in the member variable void setID(int ID); void getName(char *fName, char *lName); void setName(char *fName, char *lName); void getDept(int& d); void setDept(int d); void getSalary(double *sal);//Define Pointer Function void setSalary(double sal);//Copy the function argument to m_dSalary. void printRecord(); //Print to screen

}; #endif Here is the EmployeeRecord.cpp code:

#include #include "EmployeeRecord.h" #include #include #include #include #include

using namespace std;

EmployeeRecord::EmployeeRecord() {

//Set Values m_iEmployeeID = 0; m_sFirstName[0] = '\0'; m_sLastName[0] = '\0'; m_iDeptID = 0; m_dSalary = 0.0; }

EmployeeRecord::EmployeeRecord(int ID, char *fName, char *lName, int dept, double sal) { //Problem 1 m_iEmployeeID = ID; strcpy(m_sFirstName, fName); strcpy(m_sLastName, lName); m_iDeptID = dept; m_dSalary = sal; }

//Destructor

EmployeeRecord::~EmployeeRecord() {

}

int EmployeeRecord::getID() { return m_iEmployeeID; }

void EmployeeRecord::setID(int ID) { m_iEmployeeID = ID; }

void EmployeeRecord::getName(char *fName, char *lName) { //Problem 2 strcpy(fName, m_sFirstName); strcpy(lName, m_sLastName);

}

void EmployeeRecord::setName(char *fName, char *lName) {

strcpy(m_sFirstName, fName); strcpy(m_sLastName, lName);

} void EmployeeRecord::getDept(int& d) { d = m_iDeptID; }

void EmployeeRecord::setDept(int d) { m_iDeptID = d; }

void EmployeeRecord::getSalary(double *sal) { *sal = m_dSalary; }

void EmployeeRecord::setSalary(double sal) { m_dSalary = sal; }

void EmployeeRecord::printRecord() { cout << "ID: " << m_iEmployeeID << endl; cout << "First Name: " << m_sFirstName << endl; cout << "Last Name: " << m_sLastName << endl; cout << "Department: " << m_iDeptID << endl; cout << "Salary: " << m_dSalary << endl; } I made these files but are currently empty: CustomerList.h CustomerList.cpp Store.h Store.cpp These are the requirements for programming assignment 2:

2.0.1 This software-system shall consist of three- source files (.cpp) and three- header files (.h) defining three classes. The first class, which was- developed in phase one is the EmployeeRecord class. It will be- modified-to hold a list of stores served by an employee. The second class, which shall be called Store shall be used to store- information on a single customer store. The third class, which shall be called CustomerList shall define and maintain an ordered linked list of instances of the class Store.
2.0.2 The class EmployeeRecord, which was defined in Phase 1 shall be modified in order to maintain a list of stores served by the employee.
2.0.2.1- A pointer to a class of type CustomerList called m_pCustomerList shall be added to the EmployeeRecord class.
2.0.2.2- The constructors of the EmployeeRecord class- shall-be modified so that each- creates an instance of a CustomerList object and sets the pointer m_pCustomerList pointing to this object. The- destructor of the EmployeeRecord class shall be modified to delete this instance of CustomerList.
2.0.2.3- The function CustomerList *getCustomerList() shall be added to the EmployeeRecord class. This function shall return the pointer to the EmployeeRecord's CustomerList object.
2.0.2.4- The function getDept() shall- be modified to take no arguments but return the int value of m_iDeptID.
2.0.2.5- The function getSalary() shall- be modified to take no arguments but return the double value of m_dSalary.
2.0.3- The class Store- shall maintain information on a single customer store for the employee. This class shall hold the store ID number, name, address, city, state, and zip code. It will contain get and set functions for each of these items. It will also contain a pointer called m_pNext which- will enable a linked list of Store objects to be created and maintained by the class CustomerList. The header file and the implementation file for this class will be provided by the instructor.
2.0.4 The class CustomerList shall create and maintain an ordered linked list of Store objects arranged by Store ID.
2.0.4.1 The CustomerList class shall contain the following private variable: Store *m_pHead which shall point to the first Store instance in the list.
2.0.4.2 The CustomerList- class shall contain the following public functions: bool addStore(Store *s), Store *removeStore(int ID), Store *getStore(int ID), bool updateStore(int ID, char *name, char *addr, char *city, char *st, char *zip), and void printStoresInfo().
2.0.4.2.1 bool addStore(Store *s)--This function shall- take a pointer to a Store object which already contains all data on a store. It shall insert the Store object into the linked list in order, sorted by the store ID. It shall return TRUE if the Store was successfully added to the list.
2.0.4.2.2 Store *removeStore(int ID)--This function- shall take an integer store ID as an argument. It shall search the list, locate the Store object with that ID if one is present, remove it from the list and return the Store object. The function shall return NULL if it failed to find the Store in the list.
2.0.4.2.3 Store *getStore(int ID)--This- function shall take an integer store ID. It shall search the list, locate the Store object, if present, and return a pointer to the Store object. It shall return NULL if the Store was not found in the list.
2.0.4.2.4 bool updateStore(int ID, char *name, char *addr, char *city, char *st, char *zip)--Function shall take a list of arguments defining changes in- the store data. The- first argument gives- the store ID. The function will search the list and locate the store then update all data for that store. The function will return TRUE if it successfully updated the data or FALSE if it failed to find the store.
2.0.4.2.5 void printStoresInfo()--Function shall print all data on each store in the list. Any help would be greatly appreciated

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Spatial Databases 2nd Symposium Ssd 91 Zurich Switzerland August 1991 Proceedings Lncs 525

Authors: Oliver Gunther ,Hans-Jorg Schek

1st Edition

3540544143, 978-3540544142

Students also viewed these Databases questions