Professional Documents
Culture Documents
a) Declare the class CVectorQueue. The class has methods like the CQueue_h. As attributes, two
pointers are used, one points to the actual Queue, one to the newly created Queue. Additio-
nally, the actual size has to be stored.
c) Implement the add function of the class CQueueVector. If the function cannot write the pMsg
into the Queue, because it is full, than:
a. A new Queue of double size is created
b. All Messages from the old Queue are copied into the new Queue
c. The Message pMsg is written
d. The old Queue is deleted.
d) Implement the get-Function. This function does not change the size of the actual Queue.
Prof. Dr. J. Wietzke, HsKA Karlsruhe Fak. MMT, Informatik, Moltkestr. 30, 76133 Karlsruhe;
Seite 1
MECB 440 - Klausur Informatik II
chapter 2: CMotor
Prof. Dr. J. Wietzke, HsKA Karlsruhe Fak. MMT, Informatik, Moltkestr. 30, 76133 Karlsruhe;
Seite 2
MECB 440 - Klausur Informatik II
chapter 3: The main system, combination of chapter 1 and 2
Our main program creates an object of CVectorQueue of size 2 and then splits up a child/son thread.
The father thread writes every second a random rpm value between -1000 and 1000 rpm into a mes-
sage and writes this message into the Queue. This should repeat for 120 seconds, then the program
exits.
The son thread creates an object of CMotor, reads from the Queue and uses the values to control the
Motor. After 120 seconds, the son exits.
Send in your program as a zipped project. Make sure it runs and does, what is specified. Use your de-
bugger.
You might show the rpm steps on the display as well as the Queuesize changes, if you like.
Prof. Dr. J. Wietzke, HsKA Karlsruhe Fak. MMT, Informatik, Moltkestr. 30, 76133 Karlsruhe;
Seite 3