Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help me to compile the code for all the task. Thank you. Question 2 [30 Marks] Given a CH program file, Test2(031219)_Q2.cpp, which contains

image text in transcribedimage text in transcribed Please help me to compile the code for all the task. Thank you.

Question 2 [30 Marks] Given a CH program file, Test2(031219)_Q2.cpp, which contains a linked list implementation of stack to manage a car(s) in Munir Garage. The garage allow ten cars to be parked in a space that would usually fit only one. The definition of the class nodeStack and stack are given in the program file. The variable top in the class stack is a pointer which points to the top node of the stack. The implementation of the method createStack() and isEmpty() of the class stack are also given in the Test2(031219)_Q2.cpp. You must not change any line of code regarding the definition of the class nodeStack and stack. Complete the implementation of push(), pop(), display () and search() function by appending the appropriate lines of code at the space provided in Test2(031219)_Q2.cpp to accomplish each of the following tasks: Task 1: Write the code to insert new car to the stack. Firstly, ask the user to enter the information of the car which is the plate number, brand/ model and owner's name. Note: Please use the variables defined in line 59. Then, insert the new car by using the infomation entered (please use the object pointer defined in line 60). (8 marks) Task 2: Write the code to remove the car from the stack (please use the object pointer defined in line 94). (3 marks) Task 3: Write the code to display all the cars in the stack (please use the object pointer defined in line 121). (9 marks) Task 4: Write the code to search the car in the stack based on brand/ model (please use the object pointer defined in line 151). (10 marks) Figure 8(a) and 8(b) show the expected output when the program runs. Note: The values in bold are input by the user. MUNIR GARAGE MANAGEMENT SYSTEM MUNIR GARAGE MANAGEMENT SYSTEM 1. Insert car 2. Remove car 3. Search car 4. Display cars 5. Exit 1. Insert car 2. Remove car 3. Search car 4. Display cars 5. Exit Enter your choice (1-5): 1 Enter your choice (1-5): 4 >>>>>> >>>>>> Plate Number : JPQ1234 Brand/ Model : Nissan Owner : Sofea Ali [2] Plate Number : VAT8976 Brand/ Model : Nissan Owner : Ari. Al MUNIR GARAGE MANAGEMENT SYSTEM [2] Plate Number : MAX 4567 Brand/ Model : Honda Owner : Anis Ali 1. Insert car 2. Remove car 3. Search car 4. Display cars 5. Exit [3] Plate Number : JEQ1234 Brand/ Model : Nissan Owner : Sofea Ali > Enter your choice (1-5): 1 MUNIR GARAGE MANAGEMENT SYSTEM >>>>>> Plate Number : MAX 4567 Brand/ Model : Honda Owner : Anis Ali 1. Insert car 2. Remove car 3. Search car 4. Display cars 5. Exit MUNIR GARAGE MANAGEMENT SYSTEM Enter your choice (1-5): 3 >>>>>> 1. Insert car 2. Remove car 3. Search car 4. Display cars 5. Exit Enter brand/ model: Nissan Enter your choice (1-5): 1 Plate Number : VAT8976 Brand/ Model : Nissan Owner >>>>>> Plate Number : VAT 8976 Brand/ Model : Nissan Owner : Arif Ali Plate Number : JPQ1234 Brand/ Model : Nissan Owner : Sofea Ala > Figure 8(a): The output of the program for Question 2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Seven NoSQL Databases In A Week Get Up And Running With The Fundamentals And Functionalities Of Seven Of The Most Popular NoSQL Databases

Authors: Aaron Ploetz ,Devram Kandhare ,Sudarshan Kadambi ,Xun Wu

1st Edition

1787288862, 978-1787288867

More Books

Students also viewed these Databases questions

Question

List three functions of membrane proteins.

Answered: 1 week ago

Question

Explain why it is important to understand elasticity of demand

Answered: 1 week ago