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:00
In outlook how can cherie look at the details of an event that appears on the month view of her calendar? check all that apply. by switching to the detail view by switching to the week view by switching to the day view by right-clicking on the event by double-clicking on the event by highlighting the event
Answers: 2
question
Computers and Technology, 22.06.2019 14:20
Cengagenowv2 is a comprehensive online learning tool. using cengagenowv2, you may access all of the following except: 2. each time you log in, cengagenowv2 automatically performs a system check and informs you if your computer does not meet the cengagenowv2 system requirements. 3. which tab/page allows you to easily track your assignment scores, number of submissions, time spent, as well as the ability view assign
Answers: 3
question
Computers and Technology, 22.06.2019 22:00
Competent nonverbal communication involves interacting with others in a manner that is appropriate for which of the following? select all that apply. situation task individuals
Answers: 3
question
Computers and Technology, 23.06.2019 12:00
What type of slide show is a dynamic and eye-catching way to familiarize potential customers with what your company has to offer? a. ole b. photo album c. brochure d. office clipboard
Answers: 2
You know the right answer?
4.12 program 4, part 3: the "drunken sailor" problem 1. introduction this assignment, which introdu...
Questions
question
Mathematics, 12.11.2020 01:50
question
English, 12.11.2020 01:50
question
Mathematics, 12.11.2020 01:50
question
Business, 12.11.2020 01:50
question
Chemistry, 12.11.2020 01:50
question
Mathematics, 12.11.2020 01:50
question
Spanish, 12.11.2020 01:50
Questions on the website: 13722361