PROBLEM DEFINITION: Write a program that has three functions that do the following (identify parameters and returned values for each function): A...

CS115 INTRODUCTION TO COMPUTER PROGRAMMING Programming project #4 INTRODUCTION The goal of this programming assi gnment is to enable you to practice programming using lists . PROBLEM DEFINITION : Write a program that has three functions that do the following (identify parameters and returned values for each function) :  A main() function that calls the other two functions and then displays the norm * (see below) .  A fillVector () function to i nput as many numbers (float or double) into a list as the user wants . The program should validate input i.e. reject non -num bers.  A compute Norm () function to calculate the norm of the vector. A norm of a vector is defined as the square root of the sum of the squares of vector elements : For example, given vector x = [ -2 3 -1] The norm is |x | = √ ( (-2) 2 + 3 2 + ( -1)2 ) = 3.74 * The message displayed by the main() function should be descriptive. For example: The norm of your vector is 3.74 Write a statement at the bottom of the program to call the main() function. THE PYTHON PR OGRAM The program should do what is specified in the PROBLEM section above. The program shou ld have the following features: 1) The first few lines of your program should be comments that state the program name, t he author’s (your) name, date the program is released, and a brief description of the main task performed by the program. 2) Your program should have meaningful variable names . There should be a comment before each function definition and at each major funct ion point: input, calculation, output , loop . EXTERNAL DOCUMENTATION Type a report of your solution in a Word or OpenOffice Writer document. You should structure your document in four clear sections each with a subheading as follows: 1. PROBLEM DEFINITION The problem definition comes here. This is a summary of the PROBLEM section above. 2. ANALYSIS Give the variables that you have identified to hold data and explain the type of data for each variable. Give variables to store results of formul as. Also give variables to hold constants. Give formulas to convert input data to output data using vari able names that you identified (do not copy the formula given in the PROBLEM DEFINITION section of this document. Rather, use your own variable names in the formula) . 3. DESIGN Explain the reasoning of the structure and logic of your program. Give the algorithm in pseudocode form of the step by step statements to carry out the required programming task in English phrases. Pseudocode should be structured meaning that phrases inside if … or while … or for … or functions should be indented. Pseudocode should be in nicely listed phrases not English prose. Pseudocode should not be i n Python . 4. IMPLEMENTATION What was the platform and programming environment used? Name the Operating System and compiler. How did you test your program? Give the data used to test the program. Did you encounter any unusual situations when running the pr ogram (For example, what happens when an alphabetic character is input instead of a n account number )? PROGRAM RUN RECORD [see the APPENDIX at the end o f this document] Run your program and save the program run session. For example, if you use IDLE you can click on File on the menu and choose Save as … then change the Save as type to Text files before typing the file name and clicking on SAVE . SUBMISSION METHOD a) Upload to Blackboard a copy of your external documentation. b) Upload to Blackboard a copy of your program (not MS Word or PDF or RTF or WPS formats but as generated by your editor saved with a . py extension ). c) A text file containing the record of the program run session. You will click on the bl ack words “Programming project 4 ” in the “Programming projects” area on Blackboard and then click on “ Browse My Computer” then attach your external documentation document, again click “Browse My Computer” and attach the program , and again click “Browse My Computer” and attach the record of program run before finally clicking SUBMIT. GRADING This program will be graded out of 10 0 points distributed as follows: ITEM MAX. POINTS External documentation . . . . . . . . . . . . . . . . . . . . . 30 Style : comments, meaningful names, . . . . . . . . . . 10 indenta tion Program compiles error free . . . . . . . . . . . . . . . . . 30 Program works correctly . . . . . . . . . . . . . . . . . . . . 30 APPENDIX There are three tasks as follows: 1) Read the “PROBLEM DEFINITION” and think what you will need and how you will arrange statements. a) Variables appear in formulas or hold data read from keyboard or calculated. b) Imagine your program was running at on a computer. What would it do first, then second, then third? Notice that order matters. For example, comparison based on input means input comes first then comparison is done. c) Your thought process is written in the “ ANALYSIS” and “DESIGN” parts of the external documentation. The order of tasks is presented using pseudocode. 2) Take the ideas you came up with in (1) above and put them into Python code. You can write the Python code on paper first. Use yo ur textbook to find examples of how to translate pseudocode into Python. Next do the following assuming you are using IDLE . a) Run IDLE b) Click on “File” on the menu and select “New file”. This will open an editor. c) Type your Python program in the editor. d) Click “File” on the menu and then click “Save as”. Give your program a name (for example normFinder ) and click “Save”. In this example it will be saved as normFinder .py 3) Next run your program and record a run session as follows: a) In the edito r window, click “Run” on the menu then select “Run module”. Your program will run in the IDLE shell. b) Type keyboard responses to your program and see what the program prints out. c) Click on “File” on the shell window menu and select “Save as”. Change the “S ave file type” to Text files. Give a file name (for example vectorNorm Run1) . d) Click “Save”. In this example the file will save with vectorNorm Run1.txt name. This is a record of your program run saved to a text file