logo
call

Chat with support 24/7

1-239-690-6577

Professional Custom Essay Writing Service

Order from the best essay help service in the whole world!

...content here............

Computer Science Assessment – Java Object Oriented Programming

Document Preview:

Faculty of Science Department of Computing Final Examination 2013 Unit: COMP229 Object Oriented Programming Practices Release Date: 9:00am, November 15, 2013 Due Date: 11:45pm, November 19, 2013 Total Number of Questions: Six (6) Total Marks: Sixty Four (68) Instructions: Answer ALL questions. All references to program code or behaviour refer to the Java language. All answers to questions that ask for code must be written using Java. Every attempt has been made to make questions unambiguous. However, if you are not sure what a question is asking, make some reasonable assumption and state it at the beginning of your answer. COMP229 Object Oriented Programming Practices, November 2013 Question 1 (Design Patterns, 5 marks) The template method pattern and the strategy pattern both abstract some computation in the form of methods. What dening characteristic distinguishes the template method patern from the strategy pattern? Explain your answer. [5 marks] Question 2 (Concurrency, 12 marks) Consider the following class denition. This class is considered to be in an inconsistent state if the isConsistent() method returns false; public class Foo long mValue ; long mValueTimesTwo ; /** * Sets the state of our object . ** Pauses briefly between setting the first and second * values in order to increase the probability that the * object will be interrogated while in an inconsistent * state . ** @param pValue the value to update the current state with , */ public synchronized void setValues (long pValue ) mValue = pValue ; doPause (3); mValueTimesTwo = pValue * 2; /** * Checks to see if the current state of our object is * consistent . ** @return true if it is. */ public synchronized boolean isConsistent () return ( mValue * 2 == mValueTimesTwo ); /** * Utility routine – pauses our thread by calling * sleep and supressing any InterruptedException . */ private static void doPause (long pPause ) try Thread . sleep ( pPause ); catch ( InterruptedException e) e….

Need a Professional Writer to Work on Your Paper and Give you Original Paper? CLICK HERE TO GET THIS PAPER WRITTEN

Place a custom essay order similar to this or any related topic. NB: The assignment paper will be written from scratch as per your instructions and it will be 100% original. It will pass all plagiarism check.

endwhile; ?>

Check Our Prices

Free Quote

 

TRACK YOUR ORDER

All kinds of papers in all subject areas

We can successfully deal with all kinds of school assignments corresponding to various academic disciplines. Among these school papers are:

  • Custom essays
  • Dissertations and theses (undergraduate, Master's, PhD)
  • Research and term papers
  • Courseworks and case studies
  • Admission essays and personal statements, etc.
University of Nairobi