subject

4.12 program 4, part 3: the "drunken sailor" problem 1. introduction this assignment, which introduces the use of loops, solves the following problem: given a starting location in a city, how long does it take a "drunken sailor" who randomly chooses his direction at each intersection to reach the city's border? you will read input values to set up the problem parameters, run several trials to determine an average number of steps for the sailor to reach the border, and output the results. this problem is an example of a "random walk,"a succession of random steps that can model real world problems like stock price fluctuation or molecules traveling through liquid. the approach is a simple approximation of a monte carlo experiment, in which repeated random samples are run to find a numerical result. this assignment has been split into three parts to teach you how to build a large program in smaller pieces. doing so makes the program easier to develop and test--you can make sure each smaller piece works and then integrate the pieces together. in this lab, part 3, you wil integrate your solutions to parts 1 and 2 and add some additional code to allow for multiple trials. remember, in addition to submitting your code, you must complete the blackboard assignment "program 4 style assessment" to get all of the points for this program. you can complete this "assignment" by typing a short message indicating you submitted your code through the textbook ide in your blackboard submission, indicate which of the three parts of the program you have completed. if you plan to complete all three parts, do not submit to blackboard until all parts are done. 2. specification problem description the city is organized as a set of m x n blocks. the sailor's position, which mu ays be an intersection or a point on the border, can be represented as a pair of coordinates (x, y), where 0 s xs m, and 0s y sn. see figure1 in the figures document for an example of a 4 x 3 city with the sailor at position (3, 2). the figures document also contains a general flowchart for the overall program. you have written parts of the program in the prior two sections; the flowchart should give you some idea how to integrate those parts together. input specification the input specification is defined in section 4.10, which contains part 1 of this assignment. note that, unlike part 2 of the assignment, the city size and sailor's starting position should be based on user input, not on predefined values. output specification most of the output specification is defined in the prior 2 parts of the assignment (sections 4.10 and 4.11). your part 3 solution, however, must include the following changes. because your program can now contain multiple, trials, the "start" and "end" messages for each trial must include the trial number (for example, trial # 1 start : 1 1 or trial # 3 total steps : 7) after all trials are complete, your program should print the average number of steps across all trials (for example, average # of steps over 3 trials: 3.33) detailed test cases showing appropriate input prompts can be found starting on page 3 of the figures document. error checking the list of possible errors is defined, along with the program input specification, in section 4.10 3. hints multiple trials each trial takes the sailor back to the original starting position (based on user input) and starts over. doing so may require you to declare some additional variables you did not need in parts 1 or 2. some of those variables can be initialized once in the program, while others may need to be re-initialized at the start of each trial. flow chart as mentioned above, the figures document contains a general flowchart for the overall program. 4. grading rubric as with prior assignments, 40 points will be assigned for programming style and 60 points will be assigned for successfully passing the auto-graded test cases the style points will be based on all three parts of the program-you must use appropriate coding style such as including appropriate comments, indenting the main0 function body, and appropriate variable declarations. you must complete the blackboard assignment "program 4 style assessment" to earn any of these points. when assessing output correctness, this part of the assignment is worth 20 of the 60 total points. each test case has a different number of points assigned to it, as shown in submit mode. this section will be auto-graded, while i will assign the other 40 points after inspecting your program.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 06:50
Type the correct answer in the box. spell all words correctly. which view of report creation allows you to customize the report before the database program creates it? creating a report in allows you to customize the report before the database program creates it. pl asap
Answers: 1
question
Computers and Technology, 22.06.2019 19:00
How is the number 110 written when expanded out to place values in the base 2 (binary) number system? options: 2 x 4 + 3 x 2 + 4 x 1 1 x 2 + 1 x 2 + 0 x 2 1 x 100 + 1 x 10 + 0 x 1 1 x 4 + 1 x 2 + 0 x 1
Answers: 1
question
Computers and Technology, 22.06.2019 23:20
How can you tell if someone sent you a text message to your email instead of a email
Answers: 1
question
Computers and Technology, 24.06.2019 02:10
Which sentences describe the things you need to ensure while creating a sketch and a drawing? while an artistic or creative drawing is a creative expression, a technical drawing is an informative expression. you need to create accurate and neat drawings to convey accurate information. a technical drawing clearly conveys its meaning or information, and does not leave room for interpretation maintain a good speed while creating drawings
Answers: 1
You know the right answer?
4.12 program 4, part 3: the "drunken sailor" problem 1. introduction this assignment, which introdu...
Questions
question
Chemistry, 22.08.2019 14:10
Questions on the website: 13722363