V.18 Write a program that emulates a stack using a linked list. Implement the menu using an enumerated type. Write funct

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

V.18 Write a program that emulates a stack using a linked list. Implement the menu using an enumerated type. Write funct

Post by answerhappygod »

V 18 Write A Program That Emulates A Stack Using A Linked List Implement The Menu Using An Enumerated Type Write Funct 1
V 18 Write A Program That Emulates A Stack Using A Linked List Implement The Menu Using An Enumerated Type Write Funct 1 (90.03 KiB) Viewed 56 times
V 18 Write A Program That Emulates A Stack Using A Linked List Implement The Menu Using An Enumerated Type Write Funct 2
V 18 Write A Program That Emulates A Stack Using A Linked List Implement The Menu Using An Enumerated Type Write Funct 2 (90.03 KiB) Viewed 56 times
V 18 Write A Program That Emulates A Stack Using A Linked List Implement The Menu Using An Enumerated Type Write Funct 3
V 18 Write A Program That Emulates A Stack Using A Linked List Implement The Menu Using An Enumerated Type Write Funct 3 (61.39 KiB) Viewed 56 times
V 18 Write A Program That Emulates A Stack Using A Linked List Implement The Menu Using An Enumerated Type Write Funct 4
V 18 Write A Program That Emulates A Stack Using A Linked List Implement The Menu Using An Enumerated Type Write Funct 4 (62.88 KiB) Viewed 56 times
V 18 Write A Program That Emulates A Stack Using A Linked List Implement The Menu Using An Enumerated Type Write Funct 5
V 18 Write A Program That Emulates A Stack Using A Linked List Implement The Menu Using An Enumerated Type Write Funct 5 (64.93 KiB) Viewed 56 times
V.18 Write a program that emulates a stack using a linked list. Implement the menu using an enumerated type. Write functions to implement each of the following tasks. Push Pop IsEmpty Peek Size Then provide a menu for the user to choose one of these 5 options (error check the input to ensure it is in the proper range). If they choose push allow them to enter in a name, gender, and age. If they choose pop, let them know all the info about the person who is being removed (if the list is empty, let them know). If they peek, show them who is at the top of the list. Use an enumerated type for the menu. If they choose size, tell them how many people are in the list. Validate the user input. →This lab will must be demonstrated. a Turn in as a single PDF file (IN THIS ORDER) 1. screen I/O-pasted into a text file within eclipse and printed with line numbers. 2. Your header file. 3. a listing of main.cpp (conforming to style discussed in class) 4. a listing of your functions 5. a listing of your print heading function OUTPUT MESSAGE FORMAT Check below for a more detailed description of the expected input and output Invalid command inputs Out of range error: **** The number 12 is an invalid entry **** Please input a number between 0 and 5 **** **** Please input a NUMBER between 0 and 5* Size For more than one: There are 2 people on the stack. For one: There is one person on the stack. For an empty stack: Nobody is on the stack! Peek if the stack is empty: There is nobody to PEEK at !! **** Empty For an empty stack: Yes, the stack is empty. For a non-empty stack: The stack is NOT empty. Pop If the stack is empty: Can't POP from an empty stack!
Example Screen Input/Output should be formatted as follows (You do not need to format your data into two columns as shown on the next page) STACK MENU: 1-Add a person (PUSH) 2-Remove a person (POP) 3-Is the stack empty? (ISEMPTY) 4-Who is on top? (PEEK) 5-How many people are there? (SIZE) 0-to Exit Enter a command? 1 Who would you like to add? Enter Name: Joe Smith Enter Gender: M Enter Age: 32 <redisplay menu> Enter a command? 1 Who would you like to add? Enter Name: Grace Hopper Enter Gender: F 69 Enter Age: <redisplay menu> Enter a command? 4 Double Space (1 blank line) PEEKING at Name: Grace Hopper Gender: F Age: 69 <redisplay menu> Enter a command? 5 There are 2 people on the stack. <redisplay menu> Enter a command? 1 Who would you like to add? Enter Gender: F Enter Age: 52 <redisplay menu> Enter a command? 4 SEKING at Name: Ada Lovelace Gender: F Age: 52 <redisplay menu> Enter a command? 3. The stack is NOT empty. <redisplay menu> Enter a command? 2 POPPING Name: Ada Lovelace Gender: F Age: 52 <redisplay menu> Enter a command? 1 Who would you like to add? Enter Name: Charles Babbage Enter Gender: M Enter Age: 25
Enter a command? 4 PEEKING at Name: Charles Babbage Gender: M Age: 25 <redisplay menu> Enter a command? 5 There are 3 people on the stack. <redisplay menu> Enter a command? 2 POPPING Name: Charles Babbage Gender: M Age: 25 <redisplay menu> Enter a command? 5 There are 2 people on the stack. <redisplay menu> Enter a command? 4 PEEKING at Name: Grace Hopper Gender: F Age: 69 <redisplay menu> Enter a command? 2 POPPING Name: Grace Hopper Gender: F Age: 69 <redisplay menu> Enter a command? 5 There is one person on the stack. <redisplay menu> Enter a command? 3 The stack is NOT empty. <redisplay menu> Enter a command? 4 PEEKING at Name: Joe Smith Gender: M Age: 32 <redisplay menu> Enter a command? 2 POPPING Name: Gender: M Age: 32 Joe Smith <redisplay menu> Enter a command? 5 Nobody is on the stack! <redisplay menu> Enter a command? 2 Can't POP from an empty stack! <redisplay menu> Enter a command? 3 Yes, the stack is empty.
<redisplay menu> Enter a command? 4 There is nobody to PEEK at! <redisplay menu> Enter a command? -1 **** The number -1 is an invalid entry **** Please input a number between 0 and 5 <redisplay menu> Enter a command? 6 *** The number 6 is an invalid entry **** Please input a number between 0 and 5 <redisplay menu> Enter a command? abc **** Please input a number between 0 and 5 **** <redisplay menu> Enter a command? 0
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply