90 likes | 297 Views
Project 3: Farey Sequences. Farey Sequences. Programming Assignment 1. Drozdek, Page 133. Further details about Farey sequences, and more examples, can be found in the Wikipedia article: http://en.wikipedia.org/wiki/Farey_sequence. Specifications.
E N D
Farey Sequences Programming Assignment 1. Drozdek, Page 133 Further details about Farey sequences, and more examples, can be found in the Wikipedia article: http://en.wikipedia.org/wiki/Farey_sequence
Specifications • Repeatedly prompt the user to enter a level and display the Farey sequence of that level. • Terminate when the user enters zero or a negative value. • Your output should match the sample run on the next slide for the same inputs.
Specifications • Define a class Fraction. • Define an insertion operator ( << ). • Use our List template with a parameter of Fraction. • Modify printAll to output all elements on the same line. • Except for printAll, do not modify the List template. • Define a function in main to create a Farey sequence of level N as a list of fractions.
Implementation Hints • Create a level 1 Farey sequence as a list of two fractions, {0/1, 1/1}. • Use a loop (not recursion) to build up from level 1 to level N. • Use the traverseList method to build the next level. • Traverse level i list and build level i+1 list
Ground Rules You may work with one other person. OK to work alone if you prefer. If you do work as a pair Both members are expected to contribute. Submit a single program. Both members should understand the program in detail. Do not share your work with other students. Before or after submitting the project. OK to discuss the project. Do not copy any other student’s work. Don’t look at anyone else’s program. 7
Ground Rules Except for code posted on the class web site Do not copy code from the Internet or any other source. Write your own code. 8
Submission Project is due by midnight, Tuesday night, Feb 8. Deliverables: Source code only. Fraction.h, Fraction.cpp, main.cpp We will provide DLList.h Zip your source code files using the Windows “Send to Compressed Folder” command. Submit the zipped file via Blackboard Assignments. If you work with another student, include both names in the assignment comments. Other student submit assignment with just a Blackboard comment including both names. End of Presentation 9