Case study Students are provided with the following programming problem. Students will submit a short report of 1,000 words that explains how they would approach the design and programming aspects to address the problem. Students will also submit a .ipynb file with the provided code, test cases, debugging, and the restructured code. Intent: assesses students’ knowledge on how to design and develop the source code to address the problem. Objective: This assessment task addresses the subject learning objective 1, 3 Weighting: 10% Due Date: Week 9 Task: A program compute the restaurant discount given a customer's age. Kids of age 10 and under are free (100% discount), and seniors of age 60 and over get a 20% discount. A pseudocode for a program to calculate restaurant discount is: 1 integer userAge 2 integer discountPercent 3 userAge = Get next input 4 if userAge <= 10 5 discountPercent = 100 6 if userAge >= 60 7 discountPercent = 20 8 if (userAge > 10) and (userAge <= 60) 9 discountPercent = 0 10 Put "Discount is " to output 11 Put discountPercent to output 1. Code the previous in python in google colab notebook. Name it student_name_Assessment2.ipynb 2. Apply the following test cases on the developed python code Case 1: userAge: 9. Case 2: userAge: 10. Case 3: userAge: 30. Case 4: userAge: 59. Case 5: userAge: 60. Case 6: userAge: 61. Note: All cases must be in your .ipynb file. Don't change values and run the test case. Keep all test cases. Insert screenshots in your report. 3. Register your test cases in a table in your report. The table will have 4 columns: Case - Expected - Output - Evaluation(No error or Error) 4. Identify the logical error in the previous code (which line has the error) after applying the test cases. Discuss the reason of the error. 5. Apply methods to debug the error. Which lines will you add a breakpoint() before or after? Write this in a new code section in your .ipynb file. Insert screenshots in your report for the code with debugging statements. 6. Run the debugging to show the values of the userAge and discountPercent with the test case that has error. Insert screenshots in your report. Which commands did you use to run the debugging. 7. What are the commands that you used to print the values of userAge and discountPercent? Which command did you use to exit the debugging mode. Insert screenshots in your report. 8. How wi
University/Course:
Uploaded: November 12, 2024
Files: 2