using C++ 1- Creates a class called Member with two integer x and y. a. Add a constructor able to create a Member object with tow integers and the default values 0,0. b. Add the methods setX and setY to modify the attributes x and y; [2 Mark c. Add the method display able to display the attributes. 2- A Stack is a special array where the insertion and deletion will be via a specific index called "head". A Stack is characterized by 3 attributes: a. capacity (int): the maximum number element Member that can be contained into the Stack. b. head: presents the index where we can add/remove element to the Stack. The head value presents also the current number of elements into the Stack. When a Stack is created the initial value of head is 0. c. Member content[]: an array of elements of type Member. Creates the class Stack with the following methods: a. bool empty(): this method returns true if no element exists in the Stack. b. bool full(): this method returns true if there are no place to add a new element to the Stack. c. overload the operator += (Member): able to add an element to the Stack. You need to be sure that there is an available space in the Stack: (use assert (condition); from , the condition must describe the existence of an available space). When a member is added, the head index will be increased. d. delete(): able to delete an element from the Stack. You need to be sure that there is at least one available member in the Stack (use the assert function). When a member is deleted, the head index will be decreased. e. display(): a method able to display all the member elements existing in the Stack; 3- Creates a function main() to test the program: a. Creates a Stack. b. Creates 3 Members and then insert all of them into the Stack. c. Display the Stack. d. Delete an element from the Stack.
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
using C++
1- Creates a class called Member with two integer x and y.
a. Add a constructor able to create a Member object with tow integers and the default values 0,0.
b. Add the methods setX and setY to modify the attributes x and y; [2 Mark
c. Add the method display able to display the attributes.
2- A Stack is a special array where the insertion and deletion will be via a specific index called "head". A Stack is characterized by 3 attributes:
a. capacity (int): the maximum number element Member that can be contained into the Stack.
b. head: presents the index where we can add/remove element to the Stack. The head value presents also the current number of elements into the Stack. When a Stack is created the initial value of head is 0.
c. Member content[]: an array of elements of type Member.
Creates the class Stack with the following methods:
a. bool empty(): this method returns true if no element exists in the Stack.
b. bool full(): this method returns true if there are no place to add a new
element to the Stack.
c. overload the operator += (Member): able to add an element to the Stack. You need to be sure that there is an available space in the Stack: (use assert (condition); from <cassert>, the condition must describe the existence of an available space). When a member is added, the head index will be increased.
d. delete(): able to delete an element from the Stack. You need to be sure that there is at least one available member in the Stack (use the assert function). When a member is deleted, the head index will be decreased.
e. display(): a method able to display all the member elements existing in
the Stack;
3- Creates a function main() to test the program:
a. Creates a Stack.
b. Creates 3 Members and then insert all of them into the Stack.
c. Display the Stack.
d. Delete an element from the Stack.
e. Display the Stack for one more time.
![Example:
Member m3 (1,2)
Stack Q1;
Q1+=m3;
Stack Q1;
Q.delete();
Stack Q1;
0
===
m1
0
m1
O
m1
head
1
head
m2
==
1
1
2
head
1
m2
m2
2
2
↓
2
m3
3
3
3
4
4
4
5
5
5
6
6
6
7
==
7
7
8
8
8
9
9
9
==========](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F559a7d74-f048-4ccd-b41e-084939ca71ea%2Fab2c28d8-ede1-4692-a00e-da6f6ce03c9b%2Fp6753kb_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 4 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)