Creates a class called Member with two integer x and y. (i Mark] a. Add a constructor able to create a Member object with tow integers and the default values 0,0; [1 mark] 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, [1 Mark

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

in C++

1- Creates a class called Member with two integer x and y. 11 Mark]
a. Add a constructor able to create a Member object with tow integers and
the default values 0,0; [1 Mark]
Add the methods setX and setY to modify the attributes x and y; [2 Mark
Add the method display able to display the attributes, [1 Mark]
C.
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; [1 Mark]
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: [1 Mark]
c. Member content[]: an array of elements of type Member; [2 Mark]
Creates the class Stack with the following methods:
b.
a. bool empty(): this method returns true if no element exists in the Stack. [2
Mark]
b. bool full): this method returns true if there are no place to add a new
element to the Stack; [2 Mark]
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. [4 Mark]
C.
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. [3
Mark]
e. display(): a method able to display all the member elements existing in
the Stack; [3 Mark)
3- Creates a function main() to test the program:
a. Creates a Stack; [1 Mark]
b. Creates 3 Members and then insert all of them into the Stack; [4 Mark]
c. Display the Stack; [1 mark]
d. Delete an element from the Stack; [1 Mark]
e. Display the Stack for one more time; 11 Mark]
Transcribed Image Text:1- Creates a class called Member with two integer x and y. 11 Mark] a. Add a constructor able to create a Member object with tow integers and the default values 0,0; [1 Mark] Add the methods setX and setY to modify the attributes x and y; [2 Mark Add the method display able to display the attributes, [1 Mark] C. 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; [1 Mark] 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: [1 Mark] c. Member content[]: an array of elements of type Member; [2 Mark] Creates the class Stack with the following methods: b. a. bool empty(): this method returns true if no element exists in the Stack. [2 Mark] b. bool full): this method returns true if there are no place to add a new element to the Stack; [2 Mark] 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. [4 Mark] C. 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. [3 Mark] e. display(): a method able to display all the member elements existing in the Stack; [3 Mark) 3- Creates a function main() to test the program: a. Creates a Stack; [1 Mark] b. Creates 3 Members and then insert all of them into the Stack; [4 Mark] c. Display the Stack; [1 mark] d. Delete an element from the Stack; [1 Mark] e. Display the Stack for one more time; 11 Mark]
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
==========
Transcribed Image Text: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 ==========
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Unreferenced Objects
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education