Question: presidentsWstates.txt: please write in C++. add comments explaining what everything does. thanks! Stack Class: Write a Stack class using linked structure and implement the following


presidentsWstates.txt:

please write in C++. add comments explaining what everything does. thanks!
Stack Class: Write a Stack class using linked structure and implement the following functionalities. 1. push (inserts element to the front) 2. pop (removes the front element and provides content) 3. is Empty (checks whether the Stack is empty or not) 4. makeEmpty (calls pop function until the Stack is empty) 5. peek (provides the element sitting at the top/front, but does not remove) 6.print (prints all the elements) Instagram Class: You're going to \#include the Stack class in your Instagram class that will have the following functions and data members: Functions: 1. addfollower(): a given follower should be added to the follower list which is a Stack object. That means when you call this function push function from Stack should be triggered and the new follower should be added to the front of your stack. 2. removeFollower(): you don't have to pass a user name, but whenever this function is called the pop function from Stack should be triggered. That means the follower at the front/top should be removed from the list and his/her name should be provided. 3. printFollowers(): this should trigger the print() function of Stack so that you can print all the followers. 4. latestFollower(): this should trigger the peek() function of Stack so that you can print the follower who was added most recently. 5. resetFollowers(): this should trigger the makeEmpty() function of Stack so that your list can be emptied. 6. checklist(): this should trigger the isEmpty() function of Stack to verify that your list is empty. Data members: 7. "int numoffollowers" to keep track of the total number of followers 8. "DataType user" who's going to be followed. 9. "Stackfollowerlist" (this is the followerlist in a stack form, not an array!) Main Program: Your main program should \#include the Instagram class and read the presidents and their home states in the file attached. This implies that it should work with Stack that we defined in earlier assignments. Additionally, your main program should satisfy the following conditions: 1. As you read the presidents and their home states from the file, your addFollower() function should push them into the followerlist. All presidents become followers. 2. Call latestFollower() function to see the most recent president name and state (It should be Obama and IL) and print it on the screen. 3. Call removeFollower() function and print the name and the home state of the removed president. (we need to see Obama and IL on the screen again) 4. Call printFollowers() to display all the names with their states (You can use your earlier print function) 5. Call resetFollowers() to remove all followers . 6. Call checklist to verify that your Instagram object has an empty followerlist and report your finding with a message on the screen. Recommendation: 1. Please first make sure that your Stack works properly. To test that, design a main program for yourself and test all the functions to see if they are working. 2.Design your test main program in a way that it should read the file from text. 3. Once you're comfortable with your Stack class, then you can \#include it inside your Instagram class and design the functions accordingly. 4.I use parentheses to indicate something is a function. I don't mean to indicate that function takes parameter or not by leaving the inside of parentheses empty. George WashingtonVA John Adams MA Thomas Jefferson VA James Madison VA James Monroe VA John Quincy AdamsMA Andrew Jackson TN Martin Van Buren NY William Henry Harrison OH John Tyler VA James K. Polk TN Zachary Taylor LA Millard Fillmore NY Franklin Pierce NH James Buchanan PA Abraham Lincoln IL Andrew Johnson TN Ulysses S. Grant OH Rutherford B. Hayes OH James Garfield OH Chester A. ArthurNY Grover Cleveland NY Benjamin Harrison IN Grover Cleveland NY William McKinley OH Theodore Roosevelt NY William Howard Taft OH Woodrow wilson NJ Warren G. Harding OH Calvin Coolidge MA Herbert Hoover IA Franklin D. Roosevelt NY Harry S. Truman MS Dwight D. Eisenhower KS John F. Kennedy MA Lyndon B. Johnson TX Richard M. Nixon CA Gerald R. Ford MI James Carter GA Ronald Reagan CA George H. W. BushTX William J. Clinton AR George W. Bush TX Barack Obama IL Donald John TrumpFL Joseph Robinette Biden Jr. DE
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
