# Code style and testing | Computer Science homework help

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

Pages (275 words)
Standard price: \$0.00
Client Reviews
4.9
Sitejabber
4.6
Trustpilot
4.8
Our Guarantees
100% Confidentiality
Information about customers is confidential and never disclosed to third parties.
Original Writing
We complete all papers from scratch. You can get a plagiarism report.
Timely Delivery
No missed deadlines – 97% of assignments are completed in time.
Money Back