Code Style and Testing (3 marks) Refer to the below and the general “ https://docs.google.com/document/d/1M4ElGrK1qC-Kb_2CdfkPzt9Iu4x-MMo0PMYKehlesjU/edit?usp=sharingAssignment Do’s and Don’ts” doc linked to on cuLearn. All code has been well indented and has been broken down into reasonably sized procedures (no single line should be too long; aim for about 80 characters each) [1 mark] Each procedure has been well documented (but not over-documented – don’t just restate the code) with comments, including the purpose of the procedure, the expected inputs, and the expected output [1 mark] There is sufficient testing using check-expect and, at a minimum, no code is highlighted by DrRacket when the file is run [1 mark] Question 1 (3 marks) An accumulator is a procedure that is called repeatedly with a single numeric argument and accumulates its arguments into a sum. Each time it is called, it returns the currently accumulated sum. Write a procedure make-accumulator that generates accumulators, each maintaining an independent sum [2 marks]. The input to make-accumulator will correctly specify the initial value of the sum [1 mark]; for example (define A (make-accumulator 5)) (A 10) 15 (A 10) 25 Question 2 (5 marks) Write a procedure (make-queue) that produces independent first-in-first-out queue objects, using a message-passing style [2 marks]. For example: (define queue1 (make-queue)) (define queue2 (make-queue)) Write procedures to manipulate queues. At a minimum [0.5 marks each]: (queue1 ’empty?): boolean (queue1 ‘enqueue! item): adds item to the queue (queue1 ‘front): returns the next element of the queue that would be removed on dequeue (queue1 ‘back): returns the last element of the queue that would be removed on dequeue (i.e. the most recent element added) (queue1 ‘dequeue!): throws away the front element (queue1 ‘print): prints some representation of the queue from front to back
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.Read more
Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.Read more
Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.Read more
Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.Read more
By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.Read more