Stack Class Implementation with Push and Pop Functions
VerifiedAdded on 2019/10/09
|10
|2009
|76
Report
AI Summary
The assignment is divided into two parts: AD6 and AD7. In part AD6, you are required to create a stack using any data type provided in the textbook. You need to push integers, chars, doubles, Complex objects, strings, and Employee objects into the stacks. After that, pop out the objects from the stacks and compare them for equality. The output should show the class name of each object, its value or content, and whether it is equal to the popped out object or not. In part AD7, you are required to create two Employee-objects and push Date objects into their respective date stacks. Then, pop out the Employee-objects from the stacks and compare them for equality. The output should show the class name of each employee, its details, and whether it is equal to the popped out employee or not.
Contribute Materials
Your contribution can guide someone’s learning journey. Share your
documents today.
You can choose to submit either A6 (worth 150 points), AD6 (worth 180), or both (worth 180)
for 6th assignment you will get a score for this assignment either 150 points base or 180 points
base.
Grading Criteria:
1. If the submitted program cannot be compiled or run on a
Microsoft visual studio 2012 C++ compiler, the assignment will
not get any credit.
2. If the file name does not follow the naming instruction as stated
in syllabus, the assignment will get 5 to 15 points deduction.
3. If the header section of the submitted file does not include
personal information and purpose of the file, the assignment will
get 5 to 30 points deduction.
4. Late assignments will not get any credit for the assignment.
5. A submission does not follow the instructions of the assignment
will get little credit.
6. A portion of the assignment is not finished or incomplete will get
little or no credit.
7. Submit an assignment to a wrong drop box. The wrong drop box
one will not get any credit.
8. If use A for AD or AD for A assignments in the file name, the
student will not get any credit for the assignments.
9. If the submitted file(s) cannot be opened by the instructor’s
software (WinZip, Visual Studio, or text editor) the assignment
will have little credit.
10. If the submission file does not include all necessary
programming files to run the program, the program will get little
credit.
11. If the program does not separate into several files (driver,
header file, implementation file, etc.) as describe in the
assignment, the program will get little credit.
Page 1 of 11 CISP400V9A6
for 6th assignment you will get a score for this assignment either 150 points base or 180 points
base.
Grading Criteria:
1. If the submitted program cannot be compiled or run on a
Microsoft visual studio 2012 C++ compiler, the assignment will
not get any credit.
2. If the file name does not follow the naming instruction as stated
in syllabus, the assignment will get 5 to 15 points deduction.
3. If the header section of the submitted file does not include
personal information and purpose of the file, the assignment will
get 5 to 30 points deduction.
4. Late assignments will not get any credit for the assignment.
5. A submission does not follow the instructions of the assignment
will get little credit.
6. A portion of the assignment is not finished or incomplete will get
little or no credit.
7. Submit an assignment to a wrong drop box. The wrong drop box
one will not get any credit.
8. If use A for AD or AD for A assignments in the file name, the
student will not get any credit for the assignments.
9. If the submitted file(s) cannot be opened by the instructor’s
software (WinZip, Visual Studio, or text editor) the assignment
will have little credit.
10. If the submission file does not include all necessary
programming files to run the program, the program will get little
credit.
11. If the program does not separate into several files (driver,
header file, implementation file, etc.) as describe in the
assignment, the program will get little credit.
Page 1 of 11 CISP400V9A6
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
12. If the displaying result of the program is not exactly match
with the graphic in the assignment description or the displaying
result of the executable file which comes with the assignment,
the assignment will get little credit.
13. If the program does not have enough detail documentation
in the programming area the program will get 5 to 30 points
deduction.
14. If the program includes some unrelated documentation the
program will get some points deduction.
A6
Write a simple function template for predicate function isEqualTo that compares its two
arguments of the same type with the equality operator (==) and returns true if they are equal and
false if they are not equal. Use this function template in a program that calls isEqualTo on a
variety of built-in types and user define types, Complex and Date (need to overload the equality
operator (operator==) and extraction operator (operator<<)). Write a program with variety of
inputs to test the functionalities of the program.
The following are classes, functions, and private data members needed in this program. You can
add and create more classes, functions and private data members for this program.
Date class
There should have three private integer data members, month, day and year for the Date class.
It should have Date, operator<< and operator== functions in the class. The Date class has to do
a validation on data.
Complex class
There should have two private double data members, real and imaginary for the Complex class.
It should have Complex, operator<< and operator== functions in the class.
CISP400V9A6.cpp
Implement an isEqualTo template function to test with different types.
The data type and data are list as follow:
Page 2 of 11 CISP400V9A6
with the graphic in the assignment description or the displaying
result of the executable file which comes with the assignment,
the assignment will get little credit.
13. If the program does not have enough detail documentation
in the programming area the program will get 5 to 30 points
deduction.
14. If the program includes some unrelated documentation the
program will get some points deduction.
A6
Write a simple function template for predicate function isEqualTo that compares its two
arguments of the same type with the equality operator (==) and returns true if they are equal and
false if they are not equal. Use this function template in a program that calls isEqualTo on a
variety of built-in types and user define types, Complex and Date (need to overload the equality
operator (operator==) and extraction operator (operator<<)). Write a program with variety of
inputs to test the functionalities of the program.
The following are classes, functions, and private data members needed in this program. You can
add and create more classes, functions and private data members for this program.
Date class
There should have three private integer data members, month, day and year for the Date class.
It should have Date, operator<< and operator== functions in the class. The Date class has to do
a validation on data.
Complex class
There should have two private double data members, real and imaginary for the Complex class.
It should have Complex, operator<< and operator== functions in the class.
CISP400V9A6.cpp
Implement an isEqualTo template function to test with different types.
The data type and data are list as follow:
Page 2 of 11 CISP400V9A6
Data type Operant 1 Operant 2
Page 3 of 11 CISP400V9A6
Page 3 of 11 CISP400V9A6
Int 1 1
Int 2 4
Int -1 1
Int -1 -1
char a a
char a c
char c a
char c c
double 2.2 2.2
double 2.2 2.3
double -2.2 2.2
double -2.2 -2.2
Complex (10, 5) (10, 5)
Complex (10, 5) (10, 54)
Complex (10,- 5) (10, 5)
Complex (-10, -5) (-10, -5)
string abcdefg Abcdefg
string abcdefg Abcdefh
String -abcdefg Abcdefg
string -abcdefg -abcdefg
Date (2, 31, 2017) (2, 31, 2017)
Date (2, 13, 2017) (2, 14, 2017)
Date (-2, 13, 2017) (2, 13, 2017)
Date (-2, 13, 2017) (-2, 13, 2017)
Display the data type they are testing in a group and use the isEqualTo function to thes the
equality of the operants.
This assignment comes with a CISP400V9A6.zip file. It includes CISP400V9A6.exe file. The
CISP400V9A6.exe file is an executable file. You can double click the file to get to the expecting
result (see the picture below) of this assignment. You can choose any Date class and Complex
class from the textbook to start the program. You also need to follow the specification for the
CISP400V9A6.cpp to do the driver to test the program. After you finish your implementation
for the Complex class, Date class and CISP400V9A6.cpp, you can put the CISP400V9A6.cpp,
Date.h, Date.cpp, Complex.h and Complex.cpp in a project and then you can run to the same
result as the CISP400V9A6.exe.
Page 4 of 11 CISP400V9A6
Int 2 4
Int -1 1
Int -1 -1
char a a
char a c
char c a
char c c
double 2.2 2.2
double 2.2 2.3
double -2.2 2.2
double -2.2 -2.2
Complex (10, 5) (10, 5)
Complex (10, 5) (10, 54)
Complex (10,- 5) (10, 5)
Complex (-10, -5) (-10, -5)
string abcdefg Abcdefg
string abcdefg Abcdefh
String -abcdefg Abcdefg
string -abcdefg -abcdefg
Date (2, 31, 2017) (2, 31, 2017)
Date (2, 13, 2017) (2, 14, 2017)
Date (-2, 13, 2017) (2, 13, 2017)
Date (-2, 13, 2017) (-2, 13, 2017)
Display the data type they are testing in a group and use the isEqualTo function to thes the
equality of the operants.
This assignment comes with a CISP400V9A6.zip file. It includes CISP400V9A6.exe file. The
CISP400V9A6.exe file is an executable file. You can double click the file to get to the expecting
result (see the picture below) of this assignment. You can choose any Date class and Complex
class from the textbook to start the program. You also need to follow the specification for the
CISP400V9A6.cpp to do the driver to test the program. After you finish your implementation
for the Complex class, Date class and CISP400V9A6.cpp, you can put the CISP400V9A6.cpp,
Date.h, Date.cpp, Complex.h and Complex.cpp in a project and then you can run to the same
result as the CISP400V9A6.exe.
Page 4 of 11 CISP400V9A6
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
The following is a display of the expecting results.
Please document CISP400V9A6.cpp, Date.h, Date.cpp, Complex.h and Complx.cpp files properly
and zip them into a proper named zip file for an assignment (refer to the assignment section of the class
syllabus) and submit it to the A6 dropbox of the D2L Website.
Worth 150 points
AD6
Modify a stack template class from chapter 19 to push a variety of built-in types and a user
define types into a variety of built-in types’ and user define types’ stacks ( such as ints to int
stacks, and chars to char stacks) and pop them out to do a comparison.
Display procedures, type of data by using typeid( ).name(), data are compared, and equal or not
equal of the data.
Page 5 of 11 CISP400V9A6
Please document CISP400V9A6.cpp, Date.h, Date.cpp, Complex.h and Complx.cpp files properly
and zip them into a proper named zip file for an assignment (refer to the assignment section of the class
syllabus) and submit it to the A6 dropbox of the D2L Website.
Worth 150 points
AD6
Modify a stack template class from chapter 19 to push a variety of built-in types and a user
define types into a variety of built-in types’ and user define types’ stacks ( such as ints to int
stacks, and chars to char stacks) and pop them out to do a comparison.
Display procedures, type of data by using typeid( ).name(), data are compared, and equal or not
equal of the data.
Page 5 of 11 CISP400V9A6
There are Complex, Date and Employee user defied data type(need to overload the equality
operator (operator==) and extraction operator (operator<<)) in this program. Write a program
with variety of inputs to test the functionalities of the program.
The following are classes, functions, and private data members needed in this program. You can
add and create more classes, functions and private data members for this program.
Date class
There should have three private integer data members, month, day and year for the Date class.
It should have Date, operator<< and operator== functions in the class. The Date class has to do
a validation on data.
Complex class
There should have two private double data members, real and imaginary for the Complex class.
It should have Complex, operator<< and operator== functions in the class.
Employee class
The Employee class has two private string data members (firstName and lastName) and one
private Date object (birthDate).
It has Employee, operator<< and operator== public functions in the class.
Stack class
This is a template class you can get it from the textbook example to make adjustments.
The stack class has two private integers( size and top0 and 6 elements array pointer(stackPtr[6])
point to any declare data type in the textbook case is T.
There should have public Stack, push and pop functions in the class.
CISP400V9AD6.cpp
In here you need to create couple stacks for each data type and push the data into stacks and pop
them out to do comparison.
For integers: After push all numbers into two integers stacks, the two stacks should look like the
following.
Page 6 of 11 CISP400V9A6
5 5
4 4
3 -1 3 -1
2 -1 2 1
1 2 1 4
0 1 0 1
Stack1 Stack2
operator (operator==) and extraction operator (operator<<)) in this program. Write a program
with variety of inputs to test the functionalities of the program.
The following are classes, functions, and private data members needed in this program. You can
add and create more classes, functions and private data members for this program.
Date class
There should have three private integer data members, month, day and year for the Date class.
It should have Date, operator<< and operator== functions in the class. The Date class has to do
a validation on data.
Complex class
There should have two private double data members, real and imaginary for the Complex class.
It should have Complex, operator<< and operator== functions in the class.
Employee class
The Employee class has two private string data members (firstName and lastName) and one
private Date object (birthDate).
It has Employee, operator<< and operator== public functions in the class.
Stack class
This is a template class you can get it from the textbook example to make adjustments.
The stack class has two private integers( size and top0 and 6 elements array pointer(stackPtr[6])
point to any declare data type in the textbook case is T.
There should have public Stack, push and pop functions in the class.
CISP400V9AD6.cpp
In here you need to create couple stacks for each data type and push the data into stacks and pop
them out to do comparison.
For integers: After push all numbers into two integers stacks, the two stacks should look like the
following.
Page 6 of 11 CISP400V9A6
5 5
4 4
3 -1 3 -1
2 -1 2 1
1 2 1 4
0 1 0 1
Stack1 Stack2
For chars: After push all charts into two char stacks the two stacks should look like the
following.
For doubles: After push all doubles into two double stacks the two stacks should look like the
following.
For Complex: After push all Complex objects into two Complex stacks the two stacks should
look like the following.
For string: After push all string objects into two string stacks the two stacks should look like the
following.
Page 7 of 11 CISP400V9A6
5 5
4 4
3 A 3 A
2 A 2 a
1 a 1 c
0 a 0 a
Stack1 Stack2
5 5
4 4
3 -2.2 3 -2.2
2 -2.2 2 2.2
1 2.2 1 2.3
0 2.2 0 2.2
Stack1 Stack2
5 5
4 4
3 (10, -5) 3 (10, -5)
2 (10, -5) 2 (10, 5)
1 (10, 5) 1 (10, 54)
0 (10, 5) 0 (10, 5)
Stack1 Stack2
5 5
4 4
3 -abcdefg 3 -abcdefg
2 -abcdefg 2 abcdefg
1 abcdefg 1 abcdefh
0 abcdefg 0 abcdefg
Stack1 Stack2
following.
For doubles: After push all doubles into two double stacks the two stacks should look like the
following.
For Complex: After push all Complex objects into two Complex stacks the two stacks should
look like the following.
For string: After push all string objects into two string stacks the two stacks should look like the
following.
Page 7 of 11 CISP400V9A6
5 5
4 4
3 A 3 A
2 A 2 a
1 a 1 c
0 a 0 a
Stack1 Stack2
5 5
4 4
3 -2.2 3 -2.2
2 -2.2 2 2.2
1 2.2 1 2.3
0 2.2 0 2.2
Stack1 Stack2
5 5
4 4
3 (10, -5) 3 (10, -5)
2 (10, -5) 2 (10, 5)
1 (10, 5) 1 (10, 54)
0 (10, 5) 0 (10, 5)
Stack1 Stack2
5 5
4 4
3 -abcdefg 3 -abcdefg
2 -abcdefg 2 abcdefg
1 abcdefg 1 abcdefh
0 abcdefg 0 abcdefg
Stack1 Stack2
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
For Date: After push all Date objects into two Date stacks the two stacks should look like the
following.
For Employee: After push all Employee objects into two Employee stacks the two stacks should
look like the following. (ed1 and ed2 are Date objects. The ed1’s value is (3,1,2014), and ed2’s value is
(3,2,2014).)
In the program you need to display the steps that your program goes through. Such as in the
Employee test area should show
**Employee-Employee Testing Employee objects Employee-Employee**"
Create two Employee-stacks.
Push Date objects into the Date-stacks.
Push them into Date stack
Pop out Employee objects from the Employee-stacks to do comparison.
After that use a while loop to pop out the stacks, display “Objects of“ and use” typeid( ).name()”
to show class name. Use cout<< to diplay data and use == to test if the two data same or not.
This assignment comes with a CISP400V9AD6.zip file. It includes CISP400V9AD6.exe file.
The CISP400V9AD6.exe file is an executable file. You can double click the file to get to the
expecting result (see the picture below) of this assignment. You can choose any Employee class,
Date class and Complex class from the textbook to start the program. You also need to follow
the specification for the CISP400V9AD6.cpp to do the driver to test the program. After you
finish your implementation for the Complex class, Employee class, Date class and
CISP400V9A6.cpp, you can put the CISP400V9A6.cpp, Date.h, Date.cpp, Employee.h,
Page 8 of 11 CISP400V9A6
5 5
4 4
3 (-2, 13, 2017) 3 (-2, 13, 2017)
2 (-2, 13, 2017) 2 (2, 13, 2017)
1 (2, 13, 2017) 1 (2, 14, 2017);
0 (2, 31, 2017) 0 (2, 31, 2017)
Stack1 Stack2
5 ("1John", "1Lin", ed2); 5 ("1John", "1Lin", ed2);
4 ("John", "1Lin", ed1); 4 ("John", "Lin", ed2);
3 ("John", "Lin", ed1); 3 ("John", "1Lin", ed2);
2 ("John", "1Lin", ed1); 2 ("John", "Lin", ed1);
1 ("1John", "Lin", ed1); 1 ("John", "Lin", ed1);
0 ("John", "Lin", ed1); 0 ("John", "Lin", ed1);
Stack1 Stack2
following.
For Employee: After push all Employee objects into two Employee stacks the two stacks should
look like the following. (ed1 and ed2 are Date objects. The ed1’s value is (3,1,2014), and ed2’s value is
(3,2,2014).)
In the program you need to display the steps that your program goes through. Such as in the
Employee test area should show
**Employee-Employee Testing Employee objects Employee-Employee**"
Create two Employee-stacks.
Push Date objects into the Date-stacks.
Push them into Date stack
Pop out Employee objects from the Employee-stacks to do comparison.
After that use a while loop to pop out the stacks, display “Objects of“ and use” typeid( ).name()”
to show class name. Use cout<< to diplay data and use == to test if the two data same or not.
This assignment comes with a CISP400V9AD6.zip file. It includes CISP400V9AD6.exe file.
The CISP400V9AD6.exe file is an executable file. You can double click the file to get to the
expecting result (see the picture below) of this assignment. You can choose any Employee class,
Date class and Complex class from the textbook to start the program. You also need to follow
the specification for the CISP400V9AD6.cpp to do the driver to test the program. After you
finish your implementation for the Complex class, Employee class, Date class and
CISP400V9A6.cpp, you can put the CISP400V9A6.cpp, Date.h, Date.cpp, Employee.h,
Page 8 of 11 CISP400V9A6
5 5
4 4
3 (-2, 13, 2017) 3 (-2, 13, 2017)
2 (-2, 13, 2017) 2 (2, 13, 2017)
1 (2, 13, 2017) 1 (2, 14, 2017);
0 (2, 31, 2017) 0 (2, 31, 2017)
Stack1 Stack2
5 ("1John", "1Lin", ed2); 5 ("1John", "1Lin", ed2);
4 ("John", "1Lin", ed1); 4 ("John", "Lin", ed2);
3 ("John", "Lin", ed1); 3 ("John", "1Lin", ed2);
2 ("John", "1Lin", ed1); 2 ("John", "Lin", ed1);
1 ("1John", "Lin", ed1); 1 ("John", "Lin", ed1);
0 ("John", "Lin", ed1); 0 ("John", "Lin", ed1);
Stack1 Stack2
Employee.cpp, Complex.h and Complex.cpp in a project and then you can run to the same result
as the CISP400V9AD6.exe.
The following is a display of the expecting results.
Page 9 of 11 CISP400V9A6
as the CISP400V9AD6.exe.
The following is a display of the expecting results.
Page 9 of 11 CISP400V9A6
Page 10 of 11 CISP400V9A6
1 out of 10
Related Documents
Your All-in-One AI-Powered Toolkit for Academic Success.
+13062052269
info@desklib.com
Available 24*7 on WhatsApp / Email
Unlock your academic potential
© 2024 | Zucol Services PVT LTD | All rights reserved.