Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ work, not Java. Thank you. Hello! i need help with this program. Need\'s a s

ID: 3802371 • Letter: C

Question

C++ work, not Java. Thank you.

Hello!

i need help with this program.

Need's a stack class that...

push's

pop's

isEmpty

makeEmpty

peek

print.

With my stack class, i'm going to #include it in my Facebook class, which should do this...

addFriend(): add's them since they are a stack object. meaning I use the push function in the stack class

removeFriend(): remove's them with the pop function, removing them from the list.

printFriends(): this simply enables the print() function from the stack

latestFriend(): we should use the peek() fuction, printing out the latest video

resetFriends(): I believe this will do the makeEmpthy() function to empty out the friends list

checkList(): and for this we use the isEmpty() function from the stack class

These Data members can be in there too I believe
"DataTyperUser" who is going to be friended

"Stack<DataType>FriendList" this can be the friendlist in the stack form, it doesn't have to be an array

"int numOfFriends" this will track all of the friends we have

Main Program

This will #include the Facebook class, and read president's and their home states,
I have them listed like this in a text file"

etc. goes all the way down to....

All I need to know is where to put this file name in the main program, please comment where I can put that file.

With the president and homestates, the Facebook Class options should be able to this

AddFriend, should push them all into a FriendList. We want all presidents to be our friend

LatestFriend, this will print out the recent president and homestate

that sohuld come up.

All these abilities in the facebook class should work on presidents. (like ResetFriends, PrintFriends) etc, but for presidents!

i appreciate any help I can get. thank you.

Explanation / Answer

Answer:

#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
int max,i,n;
int input=-1;
class stack
{
int s[20];
public:
void insert();
void delete();
void show();
};
void stack::insert()
{
int value;
if(input==(max-1))
cout<<"Stack is full";
else
{
cout<<"enter data:";
cin>>value;
input=input+1;
s[input]=value;
}}
void stack::delete()
{
if(input==-1)
cout<<"stack is empty";
else
s[input--]='';
}void stack::show()
{cout<<"showing the contents of stack: ";
if(input==-1)
cout<<"stack is empty"<<" ";
else
{for(i=0;i<=input;i++)
cout<<s[i]<<" ";
cout<<" ";
}}
void main()
{
stack sa;
clrscr();
cout<<"enter the range:";
cin>>max;
while(1)
{
cout<<" 1.insert 2.delete 3.show 4.evalueit";
cout<<" enter ur choice:";
cin>>n;
switch(n)
{case 1:
sa.insert();
break;
case 2:
sa.delete();
break;
case 3:
sa.show();
break;
case 4:
exit(0);
default:
cout<<"Invalid option";
}
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote