Question: write the complete program given the following Description: This project's objective is to implement a novel templated queue data structure called NovelQueue in C +
write the complete program given the following Description: This project's objective is to implement a novel templated queue data structure called NovelQueue in C This queue will simulate a CPU scheduling system, managing a collection of CPU jobs and their execution characteristics. In realworld computing environments, operating systems use CPU scheduling algorithms to determine the order in which jobs processes are executed. This project simulates this concept by allowing students to manipulate a queue of CPU jobs with various attributes, including priority, job type, CPU time consumed, and memory consumption. By doing so students will gain a practical understanding of how efficient CPU scheduling is critical for optimizing system performance and managing system resources.Your Project Implementation: As part of this project, three classes are CPUJob Class, Queue class linked list and the NovelQueue. Here, I will give the required fields for each of the classes. You have the freedom to add more fields and methods.class CPUJob public: int jobid; Unique identifier for the job int priority; Priority level of the job int jobtype; Job type int cputimeconsumed; Total CPU time consumed by the job int memoryconsumed; Total memory consumed thus far ; template class Queue public: DT JobPointer; Pointer to a job eg CPUJob Queue Data Structure Operations
Implement the following operations for NovelQueue:
Add EnqueueA:
Format: A jobid priority jobtype cputimeconsumed memoryconsumed
Description: Adds a new job to the queue. After insertion, update the sorted array of pointers to ensure it reflects the new job's position based on its job ID
Remove DequeueR:
Format: R
Description: Removes the job at the front of the queue. Update the sorted array to reflect the removal and maintain its sorted order.
Modify M:
Format: M jobid newpriority newjobtype newcputimeconsumed newmemoryconsumed
Description: Searches for the job with the specified jobid dequeues it modifies its attributes as specified, and enqueues it back.
Change Job Values C:
Format: C jobid fieldindex newvalue
Description: Changes a specific field of the job with the given jobid The fieldindex corresponds to different fields such as priority, job type, CPU time consumed, or memory consumed.
Promote:
Format: P jobid positions
Description: Promotes the job with jobid towards the front by the specified number of positions. If the number exceeds its current position, move it to the front.
Reorder Based on Attributes O:
Format: O attributeindex
Description: Reorders the queue based on the specified attribute eg CPU time consumed, priority This operation returns a new instance of the reordered NovelQueue.
DisplayD:
Format: D
Description: Displays all elements of the queue, including all fields of the job record.
CountN:
Format: N
Description: Returns the number of elements in the queue.
List Jobs L:
Format: L
Description: Iterates through the array of pointers in NovelQueue sorted by job IDs and prints each job's information using the CPUJob display method. Also, shows the position of each job in the queue.
Data Structure Constraints
pointers must always be sorted based on job IDs whenever jobs are added, removed, or modified.
Operations like promotion and job attribute changes should utilize the sorted array to enhance efficiency. Use binary search on the sorted array to search jobs and ensure optimal performance.
Thoroughly test all the operations to ensure the correct functionality of the NovelQueue.
Your Project Implementation: As part of this project, three classes are CPUJob Class, Queue class linked list and the NovelQueue. Here, I will give the required fields for each of the classes. You have the freedom to add more fields and methods.
class CPUJob
public:
int jobid; Unique identifier for the job
int priority; Priority level of the job
int jobtype; Job type
int cputimeconsumed; Total CPU time consumed by the job
int memoryconsumed; Total memory consumed thus far
;
Sample Input
A
A
A
A
A
A
A
A
A
A
M
C
P
R
O
D
A
A
C
L
N
M
A
P
C
O
D
A
R
L
N
P
P
P
O
D
A
A
P
O
D
C
A
P
O
L
R
P
A
O
D
N
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
