Write procedures to manipulate queues

Assignment Help Software Engineering
Reference no: EM13317086

Question 1

Submit your answer to this question as a PDF (Question1.pdf).

Part 1

Download Question1.rkt and draw an environment diagram representing the code within. Marks will be distributed as follows:

? Global definitions are correct
? All necessary frames are present
? All frames are arranged correctly (i.e. properly nested, etc)
? Definitions within the non-global frames are correct
? All code being called in the global frame and as the bodies of functions is represented correctly

Part 2

Explain what the lines
(point getx)
(point gety)

will display, and why, ensuring you trace through the environment diagram and as you explain.

Code Style and Testing

Refer to the below and the general "Assignment 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)
? 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
? There is sufficient testing using check-expect and, at a minimum, no code is highlighted by DrRacket when the file is run

Question 2
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 . The input to make-accumulator will correctly specify the initial value of the sum; for example
(define A (make-accumulator 5))
(A 10)
15
(A 10)
25

Question 3

Write a procedure (make-queue) that produces independent first-in-first-out queue objects, using a message-passing style . For example:
(define queue1 (make-queue))
(define queue2 (make-queue))

Write procedures to manipulate queues. At a minimum:
1. (queue1 'empty?): boolean
2. (queue1 'enqueue! item): adds item to the queue
3. (queue1 'front): returns the next element of the queue that would be removed on dequeue
4. (queue1 'back): returns the last element of the queue that would be removed on dequeue (i.e. the most recent element added)
5. (queue1 'dequeue!): throws away the front element
6. (queue1 'print): prints some representation of the queue from front to back


Attachment:- ASSIGNMENT.rar

Reference no: EM13317086

Questions Cloud

What is the final temperature of the mixture : A 65-g ice cube at 0°C is placed in 665 g of water at 30°C. What is the final temperature of the mixture
What is meant by router interfaces with ssh listening : What is meant by router interfaces with ssh listening on the internet.
Determine the internal loads acting along the z-directions : The sign is attached to the post that is built-in at the ground. Treat the sign as having uniform mass. Neglect the contribution of the post weight. The length d is from the center plane of the sign to the center of the post.
Find the emf induced across its wing : An airplane of wing span 40.0 m flying horizontally at a speed of 774 km/h due north in a region where the vertical component of the earth's magnetic field is 4.75 *10^-5 T. Find the emf induced across its wing
Write procedures to manipulate queues : 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 ac..
At what rate is energy being removed : A 300-g aluminum cup contains 1000 g of water in thermal equilibrium with the cup at 65°C. At what rate is energy being removed
What is the carnot efficiency : A Carnot heat engine takes 2000J of heat from the high temperature reservoir at 227 degrees Celsius, What is the Carnot efficiency
What is the focal length of the second lens : Object O1 is 14.5 cm to the left of a converging lens with a 12.0-cm focal length. What is the focal length of the second lens
What is the flux through the flat base : A closed surface is formed from a 3.5-cm radius hemisphere ‘capped' by a flat base. what is the flux (in N m^2/C) through the flat base

Reviews

Write a Review

Software Engineering Questions & Answers

  Question about inheritance

In computer programming would you say that a function could also be called an inheritance item due to the reuse of it in the program?

  Give three network addresses

Subnet 2 is to support up to 95 interfaces, and Subnet 3 is to support up to 16 interfaces. Give three network addresses (of the form a.b.c .dJx) which fulfill these constraints.

  Frame diagrams

Prepare a frame diagram for the software systems.

  Sdlc and the role of analysis and design

In this unit, you have examined phases of the SDLC and the role of analysis and design in the overall process. A question remains, however, about the analysis and design. What methodology or approach should you use? One common methodology is the ..

  Sketching flowchart for people all in different departments

Sketch a document flowchart to depict each of the scenarios given below: Three people, all in different departments, look at the same document before it is eventually filed in a fourth department.

  Draw decision table and draw decision tree

Write structured english for clyde's narrative of the reimbursment policies. Write structure English, draw decision table and draw decision tree.

  Describe functional and nonfunctional requirements

Be typed, double spaced, using Times New Roman font (size 12), with one-inch margins on all sides; citations and references must follow APA or school-specific format. Check with your professor for any additional instructions.

  Advantages and disadvantages of implementing dfs

Explain advantages and disadvantages of implementing a DFS for this size of company, along with a recommendation for or against, and why.

  Explain what is the potential impact of changes to budgets

How can a project scope management plan help manage the3 project constraints of time, scope, and cost? What is the potential impact of changes to budgets, schedules, and deliverable if changes are allowed to occur after the project is approved

  Creating well documented object oriented application

Construct an efficient, well-documented object oriented application to manage all of job offers that an upcoming graduate is getting.

  How object oriented analysis-modeling-uml are performed

Create the research paper detailing how Object Oriented Analysis and Modeling using UML are performed. Distinguish Object Oriented processes from traditional Analysis.

  Describing arrow points to object in communication diagram

Why would you design a communication diagram instead of sequence diagram? Describe what the arrow which points to the object in a communication diagram signifies.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd