Question: Hello !! i need this ASAP c++ In this assignment, you will extend the linked_stores program we worked on in class to do the following:
Hello !! i need this ASAP c++
In this assignment, you will extend the linked_stores program we worked on in class to do the following: 1. Create an employee class (save as employee.h) as shown below
class employee{
private:
string employee_name;
int employee_grade;
double employee_salary;
public:
employee(){};
employee(string, int, double);
void set_employee_name(string);
void set_employee_grade(int);
void set_employee_salary(double);
string get_employee_name();
int get_employee_grade();
double get_employee_salary();
void print_employee_info();
};
2. Create an employee_impl.cpp file to implement all the functions defined in the employee.h file above.
3. Extend the store class to include a variable of type employee. Make the required updates to the linked_stores_impl file to ensure that your program can accept and print out both customer and employee information for each store in your linked list of stores.
store_driver
#include "linked_stores.h"
#include "employee.h"
int main(){
linked_stores* store_head_quarter = nullptr;
linked_stores* current_store = nullptr;
linked_stores* latest_store = nullptr;
linked_stores* nstore = nullptr;
char data_entry = 'Y';
cout<
cout<<"Data Entry Window"<
cout<
cout<<"Do you want to add a store (Y) or (N): ";
cin>>data_entry;
while(data_entry != 'N'){
latest_store =
latest_store->create_linked_stores(latest_store);
if(store_head_quarter == nullptr){
store_head_quarter = latest_store;
current_store = store_head_quarter;
}
else{
current_store->set_store_ptr(latest_store);
current_store = latest_store;
}
cout<
cout<<"Do you want to add another store: ";
cin>>data_entry;
cout<
}
cout<
cout<<"Data Entered Summary"<
for(current_store = store_head_quarter;
current_store != nullptr;
current_store =
current_store->get_store_ptr()){
current_store->print_linked_store_list(
current_store->get_store());
}
current_store = store_head_quarter;
current_store = current_store -> insert_new_store(
nstore, current_store->get_store_ptr());
cout<
cout<<"New Store Details "<
current_store->
print_linked_store_list(current_store->get_store());
cout<
cout<<"Updated Linked Store List"<
for(current_store=store_head_quarter;
current_store!=nullptr;
current_store=
current_store->get_store_ptr()){
current_store->print_linked_store_list(current_store->
get_store());
}
return 0;
}
linked_stores_impl
#include "linked_stores.h"
linked_stores::linked_stores(store s,
linked_stores* ls){
new_store = s;
next_store = ls;
}
void linked_stores
::set_store(store s){
new_store = s;
}
void linked_stores::
set_store_ptr(linked_stores* ls){
next_store = ls;
}
store linked_stores::get_store(){
return new_store;
}
linked_stores* linked_stores
::get_store_ptr(){
return next_store;
}
linked_stores* linked_stores
::create_linked_stores
(linked_stores* latest_store){
customer new_customer;
employee new_employee;
string cust_name, emp_name,
cust_loc;
double cust_dues,emp_salary;
int emp_grade;
cout<<"Enter Store Customer Name: ";
cin>>cust_name;
new_customer.
set_customer_name(cust_name);
cout<<"Enter Customer Location: ";
cin>>cust_loc;
new_customer.
set_customer_location(cust_loc);
cout<<"Enter Customer Balance Due: ";
cin>>cust_dues;
new_customer.
set_customer_balance_due(cust_dues);
cout<<"Enter Store Employee Name: ";
cin>>emp_name;
new_employee.
set_employee_name(emp_name);
cout<<"Enter Employee Grade: ";
cin>>emp_grade;
new_employee.
set_employee_grade(emp_grade);
cout<<"Enter Employee Salary: ";
cin>>emp_salary;
new_employee.
set_employee_salary(emp_salary);
store new_store(new_customer, new_employee);
latest_store = new linked_stores;
latest_store->set_store(new_store);
latest_store->set_store_ptr(nullptr);
return latest_store;
}
linked_stores* linked_stores::
insert_new_store
(linked_stores* latest_store,
linked_stores* current_store){
linked_stores* new_store =
latest_store->
create_linked_stores(latest_store);
linked_stores* temp =
current_store->next_store;
current_store->next_store = new_store;
new_store->next_store = temp;
current_store = new_store;
return current_store;
}
linked_stores* linked_stores::
delete_store(linked_stores* current_store){
linked_stores* temp =
current_store->next_store->next_store;
delete current_store->next_store;
current_store->next_store = temp;
return current_store;
}
void linked_stores::
print_linked_store_list(store new_store){
cout<
new_store.print_store_info(new_store.
get_customer_details());
cout<
new_store.print_store_info(new_store.
get_employee_details());
cout<
cout<
}
linked_stores
#include "store.h"
class linked_stores{
private:
store new_store;
linked_stores* next_store;
public:
linked_stores(){};
linked_stores(store, linked_stores*);
void set_store(store);
void set_store_ptr(linked_stores*);
store get_store();
linked_stores* get_store_ptr();
linked_stores*
create_linked_stores(linked_stores*);
linked_stores*
insert_new_store(linked_stores*,
linked_stores*);
linked_stores*
delete_store(linked_stores*);
void print_linked_store_list(store);
};
store.h
#include "customer.h"
#include "employee.h"
class store{
private:
customer cust;
employee store_emp;
public:
store(){};
store(customer);
store(customer, employee);
void set_customer_details(customer);
customer get_customer_details();
void set_employee_details(employee);
employee get_employee_details();
void print_store_info(customer);
void print_store_info(employee);
};
store_impl
#include "store.h"
store::store(customer c){
cust = c;
}
store::store(customer c, employee e){
cust = c;
store_emp = e;
}
void store::set_customer_details
(customer c){
cust = c;
}
customer store::get_customer_details(){
return cust;
}
void store::set_employee_details
(employee e){
store_emp = e;
}
employee store::get_employee_details(){
return store_emp;
}
void store::print_store_info
(customer ncust){
ncust.print_customer_info();
}
void store::print_store_info
(employee store_employee){
store_employee.print_employee_info();
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
