[Skip to Body]
Primary:
[Front Door]
[Schedule]
[Piazza]
-
[Academic Honesty]
[Instructions]
Current:
[Current Outline]
[Current EBoard]
-
[Current Assignment]
[Current Lab]
Groupings:
[Assignments]
[Documents]
[EBoards]
[Examples]
[Exams]
[Handouts]
[Labs]
[Outlines]
[Readings]
Related Courses:
[CSC362 2004S (Rebelsky)]
[CSC362 2010S (Stone)]
Misc:
[SamR]
[GNU Coding Standards]
[Dragon Book]
[Pascal Standards]
Assigned: Monday, 29 August 2011
Due: 11:00 p.m. Monday, 5 September 2011
This homework is also available in PDF.
Summary: In this assignment, you will write (or try to write) a few simple Pascal programs.
Purposes: To give you experience reading and writing Pascal.
Expected Time: Three to six hours.
Collaboration: You may work in groups of up to size three. You may consult with anyone you'd like on this assignment, but you should clearly document that consultation.
Submitting: Submit a tarball of your solution on Pioneerweb. Further details below.
Warning: So that this exercise is a learning assignment for everyone, I may spend class time publicly critiquing your work.
In Pascal, implement Quicksort for arrays of records of information about CDs.
For each CD, you will store the artist, the CD title, and a numeric rating (a real number) in a record structure.
You can choose whether to sort by artist, CD title, or numeric rating. (You will likely find it easiest to sort by numeric rating.)
Your program will read input from standard input. (I don't want you to have to learn the Pascal file operations.) The first line of standard input will be an integer that represents the number of records. Each CD will then occupy three lines of space. The first line will be the artist. The second will be the CD title. The third will be the rating. So, you can use something like the following to input information on a single CD:
readln(artist); readln(title); readln(rating);
Your output should have the same form.
You can find a sample input file in the examples folder.
You should store the CDs in an array and sort that array. You can assume that there will be no more than 1024 CDs.
As you know from your years of programming experience, when we don't know the size of the input data, we are often better off using a linked list than an array.
Write a program that uses linked lists to manipulate collections of CDs.
Your program should:
You may note that some aspects of this assignment are a bit less specified than they might be in an introductory course. For example, I have not given the parameters to your Quicksort routine. In part, the casual description is because you are in an upper-level course and I expect you to know the algorithms well enough to figure out the parameters. In part, I have made descriptions casual so that you must figure out the appropriate way to handle the problems in Pascal.
Create a tarball of your files. The tarball should include your Pascal programs, any input files you use, and scripts that demonstrate that you've tested your program. If you use a Makefile, you should also include that Makefile.
If possible, ensure that your tarball expands to the directory HW1.user1-user2-user3.
Submit your tarball on Pioneerweb.
I will evaluate your assignment primarily on its correctness. In particular, I will consider whether your program achieves its desired goals.
I will also evaluate your assignment on its style. I will consider how you have decomposed the problem, the names of your procedures, your indentation and commenting, and other issues that suggest that you have not only thought about how to code the problem, but how to code it well, and in a way readable to others.
Saturday, 28 August 2011 [Samuel A. Rebelsky]
http://www.cs.grinnell.edu/~rebelsky/Courses/CSC362/2011F/Assignments/pascal.html
.
[Skip to Body]
Primary:
[Front Door]
[Schedule]
[Piazza]
-
[Academic Honesty]
[Instructions]
Current:
[Current Outline]
[Current EBoard]
-
[Current Assignment]
[Current Lab]
Groupings:
[Assignments]
[Documents]
[EBoards]
[Examples]
[Exams]
[Handouts]
[Labs]
[Outlines]
[Readings]
Related Courses:
[CSC362 2004S (Rebelsky)]
[CSC362 2010S (Stone)]
Misc:
[SamR]
[GNU Coding Standards]
[Dragon Book]
[Pascal Standards]
Disclaimer:
I usually create these pages on the fly
, which means that I rarely
proofread them and they may contain bad grammar and incorrect details.
It also means that I tend to update them regularly (see the history for
more details). Feel free to contact me with any suggestions for changes.
This document was generated by
Siteweaver on Sun Nov 20 22:32:11 2011.
The source to the document was last modified on Sun Aug 28 20:11:01 2011.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS362/2011F/Handouts/pascal.html
.