Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 7 (a) When a class member is defined outside the class, which operator can be used [2 marks] (b) How do the calls of
Question 7 (a) When a class member is defined outside the class, which operator can be used [2 marks] (b) How do the calls of the functions fand h affect the states of the objects p and to associate the function definition to a particular class? q of class Point in each of the examples. Explain your answers. i. void f(Point p, Point q) [ P.x42; [2 marks] 11. void h(Point *p , Point *q) { p->x 42 p-gi 2 marks] (c) Write a class for an object called Job that has two integer variables startingTime and completionTime. Job should also have a default constructor and two pub- lic functions getProcessingTime and reschedule with the signatures: int getProcessingTime); void reschedule (int newStartingTime, int newCompletionTime); Function getProcessingTime returns the processing time as the difference between completionTime and startingTime. Function reschedule changes the values of startingTime and completionTime, respectively, to newStartingTime and newCompletionTime when the new com pletion time is greater than or equal to the new starting time. Otherwise, no action is performed The default constructor initialises both startingTime and completionTime to 0 Assuming that the C++ code has been declared separately, write the C++ body code for these functions and the default constructor. 6 marks] Total for Question 7: 12 marks]
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