Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 2 (25 points): Purpose: To practice design processes, as per Chapter 5. Degree of Difficulty: Moderate. Restrictions: This question is homework assigned to students
Question 2 (25 points): Purpose: To practice design processes, as per Chapter 5. Degree of Difficulty: Moderate. Restrictions: This question is homework assigned to students and will be graded. This question shall not be distributed to any person except by the instructors of CMPT 145. Solutions will be made available to students registered in CMPT 145 after the due date. There is no educational or pedagogical reason for tutors or experts outside the CMPT 145 instructional team to provide solutions to this question to a student registered in the course. Students who solicit such solutions are committing an act of Academic Misconduct, according to the University of Saskatchewan Policy on Academic Misconduct. In this question you will apply an informal design process to the task of implementing a program at the level of Assignment 1 . The purpose is to follow the process thoughtfully and reflectively. Please read the question description carefully before you start! What to Hanit In Usually this appears last, but in this question, it's first so that you know what you have to hand in. As you can see, the code you develop is a small part of this work. - Your plan to complete this question: a2q2_plan. txt - Your design document: a2q2_design.txt - Your answers to the reflection questions: a2q2_reflections,txt - Your Python program a2q2.py You are allowed to use PDF, RTF, DOC files instead of TXT. Be sure to include your name, NSID. student number, course number and lecture section at the top of all documents. Problem Specification In this question you will implement a program to solve a simple task. The task itself is related to a statistical and physical model called a Random Walk. Problem Specification In this question you will implement a program to solve a simple task. The task itself is related to a statistical and physical model called a Random Walk. A Random Walk is a string consisting of a random sequence of the letters ' L ' and ' R '. For example: 'L R R L R'. We're going to imagine that this sequence describes a person taking a step left ' L ' or right ' R ' at random along a straight line. The question we want to answer is this: In terms of steps, how far away is the person after taking all the steps? We'll call this the distance, and it will always be positive (or zero). since we don't care which side the person ends up on. Here are some examples to help clarify: - 'L L L': distance is 3 - 'R L L': distance is 1 - 'R R L': distance is 1 - 'R R R': distance is 3 - 'R L L R': distance is 0 - 'L R R L R': distance is 1 You will be given a number of datafiles containing random walks of different lengths. Each file will contain a number of lines. Each line will be a random walk. The program you must write will open the file, read each line, and then display the distance of the random walk for that line. For example, if a datafile contained the examples above, your program would display For this question you will do the following: - You will start by creating a plan for your work. Your plan will schedule time for the following development phases: - Requirements. The specification is given above, so this part of the plan includes reading the Specification section carefully. You do not need to hand in anything for this part. - Design. Your plan will indicate when you will do the design phase (day, time, location), and how long you think it will take (duration). - Implementation. Indicate when you will work on the implementation phase (day, time, location), using your design, and how long you think it will take (duration). - Testing and debugging. Indicate when you will work on testing and debugging (day, time, location), and how long you think it will take(duration). - Final clean up for submission. Indicate when you will work on clean-up (day, time, location), and how long you think it will take (duration). You must submit this plan for grading. - You will design your program, producing a design document outlining your implementation. You will submit this design for grading. - You will record the amount of time you actually spent on each phase of the plan. You will submit this information for grading. - You will record the amount of time you actually spent on each phase of the plan. You will submit this information for grading. . Details Details about the Plan On page 7 is an example table that you could use to outline your plan. It has columns for the information required above. You are not required to follow your plan exactly, to the last detail. It's a plan, not a commitment. It's helpful for monitoring your progress. You might find your plan didn't account for issues and problems that came up. That's okay. Make note of those in your reflections. Details about the Design Your design document should describe your implementation in terms of the functions you'll need to complete the program. For each function, you must specify: - Pseudo-code or informal algorithm descriptions. The form of the description is up to you. - An informal description of the inputs and outputs for each function. - An informal description of any test cases you will need to check your functions. It's important for you to keep in mind that the purpose of the design is to help you, and you should not be overly worried about the format of your design. Details about the Implementation, Testing, and Debugging Try to apply an incremental approach. For each function in your design: - Implement the function according to your design. - Test your function. - Debug as necessary. Keep track of your time during these phases. You'll want some objective evidence for how long things actually take, compared to what you estimated in your plan. This objective evidence will help you prepare more realistic plans in the future! How you actually complete these phases is less important than being objective about your progress. Details about your submitted program The program is the least important part of the assignment. Make it look presentable, by adding comments and doc-strings to your functions. Details about your reflection Your answers to the reflection questions below are graded for relevance and thoughtfulness of your answer. There are no right answers, and the only way to lose these marks is to fail to reflect meaningfully. Reflection questions 1. How long fid it take for you to create your plan? 2. Did you revise your design? In other words, did any part of your implementation turn out to be significantly different from your design? If so, briefly explain the reason for the difference(s). 3. Did any of the phases take significantly longer than you had planned? If so, explain what happened, and suggest ways to avoid this in the future. Evaluation - 5 marks: Your plan allocated time to every phase of the development process, and the times were 2. Did you revise your design? In other words, did any part of your implementation turn out to be significantly different from your design? If so, briefly explain the reason for the difference(s). 3. Did any of the phases take significantly longer than you had planned? If so, explain what happened, and suggest ways to avoid this in the future. Evaluation - 5 marks: Your plan allocated time to every phase of the development process, and the times were plausible. - 5 marks: Your design gave complete and useful details in terms of function descriptions, pseudo-code algorithms, and test cases. - 5 marks: Your answers to the reflection questions were thoughtful and relevant. - 5 marks: Your program is correct, and not terribly inefficient. - 5 marks: Your program is well-documented with helpful comments for the reader
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started