Answered step by step
Verified Expert Solution
Question
1 Approved Answer
3- search for a course 4. print course stack 5- print course stack in reverse 6- exit Please enter your selection: 3 Enter the course
3- search for a course 4. print course stack 5- print course stack in reverse 6- exit Please enter your selection: 3 Enter the course number: 262 The id: 262 does not correspond to any course in the department The program can perform the following: 1- push a course 2- pop a course 3- search for a course 4- print course stack 5- print course stack in reverse 6 - exit Please enter your selection: 3 Enter the course number: 300 The id: 300 corresponds to Design and Analysis of Algorithms The program can perform the following: 1- push a course 2- pop a course 3- search for a course 4- print course stack 5- print course stack in reverse 6- exit Please enter your selection: 6 Exiting the program... Additional Exercise: Add a method that checks whether the contents of two stacks are identical. Neither stack should be changed. Your code must preserve the contents of a stack. Sample Output Please enter the name of the department: Computer Engineering The program can perform the following: 1- push a course 2- pop a course 3- search for a course 4. print course stack 5- print course stack in reverse 6- exit Please enter your selection: 4 Computer Engineering department does not have any courses. The program can perform the following: 1- push a course 2- pop a course 3- search for a course 4- print course stack 5- print course stack in reverse 6- exit Please enter your selection: 1 Enter the course number or -1 to stop: 300 Enter the course name: Design and Analysis of Algorithms Enter the course number or -1 to stop: 356 Enter the course name: Computer Networks I Enter the course number or -1 to stop: 300 Enter the course name: testing duplicate Error! duplicate ID number... Enter the course number or -1 to stop: 325 Enter the course name: Human-Computer Interaction Enter the course number or -1 to stop: 262 Enter the course name: Fundamentals of Digital Logic Enter the course number or -1 to stop: -1 The program can perfore the following: 1- push a course 2- pop a course 3- search for a course 4- print course stack start reverse 3- search for a course 4. print course stack 5- print course stack in reverse 6- exit Please enter your selection: 3 Enter the course number: 262 The id: 262 does not correspond to any course in the department The program can perform the following: 1- push a course 2- pop a course 3- search for a course 4- print course stack 5- print course stack in reverse 6 - exit Please enter your selection: 3 Enter the course number: 300 The id: 300 corresponds to Design and Analysis of Algorithms The program can perform the following: 1- push a course 2- pop a course 3- search for a course 4- print course stack 5- print course stack in reverse 6- exit Please enter your selection: 6 Exiting the program... Additional Exercise: Add a method that checks whether the contents of two stacks are identical. Neither stack should be changed. Your code must preserve the contents of a stack. Sample Output Please enter the name of the department: Computer Engineering The program can perform the following: 1- push a course 2- pop a course 3- search for a course 4. print course stack 5- print course stack in reverse 6- exit Please enter your selection: 4 Computer Engineering department does not have any courses. The program can perform the following: 1- push a course 2- pop a course 3- search for a course 4- print course stack 5- print course stack in reverse 6- exit Please enter your selection: 1 Enter the course number or -1 to stop: 300 Enter the course name: Design and Analysis of Algorithms Enter the course number or -1 to stop: 356 Enter the course name: Computer Networks I Enter the course number or -1 to stop: 300 Enter the course name: testing duplicate Error! duplicate ID number... Enter the course number or -1 to stop: 325 Enter the course name: Human-Computer Interaction Enter the course number or -1 to stop: 262 Enter the course name: Fundamentals of Digital Logic Enter the course number or -1 to stop: -1 The program can perfore the following: 1- push a course 2- pop a course 3- search for a course 4- print course stack start reverse
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started