Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi there! Please give me the full hand written answer of this question and also attach picture of the code from your Laptop please. DO

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Hi there! Please give me the full hand written answer of this question and also attach picture of the code from your Laptop please. DO NOT FORGET TO CHECK " WHAT TO HAND IN" IN THE PAGE BEFORE THE LAST ONE. And make sure to answer ALL of its parts. IN THE END, please give the very short question related to this above question in a couple of line about your program(in the last page)

Please Solve it only if you're sure that your answer is 100% correct otherwise let any other person to solve it.

I need the Correct answer otherwise I'll give dislike and report it to the Chegg authorities. I'm tired of getting lots of wrong answers lately.

Please answer it as soon as possible with clear hand writting and thank you so much for your time and effort

uestion 1 (25 points): Purpose: To build a program and test it, starting with a design document. To get warmed up with Python, in case you are using it for the first time. Degree of Difficulty: Moderate. Don't leave this to the last minute. The basic functionality of the various parts of this question are easy. There are aspects of some parts that you won't appreciate until you start testing. References: You may wish to review the following chapters: - General: CMPT 145 Readings, Chapter 1 - Functions Review. CMPT 141 Readings: Chapter 4 - Testing Review: CMPT 141 Readings: Chapter 15 Note: A1Q2 asks about your work on A1Q1 Keep track of how long you spend working on this question, including time spent reading the question, reviewing notes and the course readings, implementing the solution, testing, and preparing to submit. Also keep track of how many times you experienced unscheduled interruptions, delays, or distractions during your work; include things like social media, phone calls, texting, but not such things as breaking for a meal, exercise, commuting to or from the university. In A1Q2 you will be asked to summarize the time you spend working on A1Q1, and your answer will be more helpful to you if you have more precise records. Background A Magic Square is an arrangement of numbers in a square, so that every row, column, and diagonal add up to the same value. Below are two squares, but only one of them is a Magic Square. The square on the left is a 33 magic square, whose rows, columns, and diagonals all sum to 15. On the right, is a 33 square of numbers whose rows columns and diagonals don't have the same sum. There are magic squares of all sizes (except 22 ), but we'll be concerned with 33 squares, and checking if a given arrangement of 9 numbers is a magic square or not. Definition: A 33 magic square is formally defined by the following three criteria: - It contains the integers 1 through 9 inclusively. - Every integer in the range 1 through 9 appears exactly once. - Every row, column, and diagonal sums to 15. In this question you will implement a program that does the following: - It asks the user for a sequence of 9 numbers from the console. The order of the numbers is important, as the rows of the grid use this order. For simplicity, assume that the user will type only integers on the console. For this question, you don't have worry about what to do if the user types anything other than integers. - It checks whether the sequence of integers is a magic square or not. Your program should display the message YES if it's magic, or ND if it's not It's very important to point out that you are not being asked to, construct a magic square; only to check if a square is magic or not. Task We've given you a design document called MagicsquareDD. txt (available on Canvas), which is the end result of a fairly careful design process. It describes a collection of algorithms which, when used together, should solve the problem. You must implement the program according to the design in this document. There will be some very small decisions you still have to make about the implementation. Every "Algorithm" in the design document will be a procedure or function written in Python. Function names should be very strongly similar to the given design, if not identical. Many of the Algorithms have a small number of test cases which you should use to check your implementation; you do not need to create formal test cases for Algorithms that do not have test cases given. It's a top-down design, but the algorithms are presented in the order they should be implemented. A good rule of thumb is this: "Design top-down. Implement bottom-up. Test each function before implementing the next. It's not a hard and fast rule, but it's a good guide. Here's how you should work with every Algorithm in the design document: 1. Read the design specification for the function. 2. Write a trivial Python function that does nothing. but has the correct name, the appropriate parameters, and a return value that's appropriate. For example: def check_diagonals(square): ,,, square: a 33 list of integers Return: True if all the diagonals sum to False othervise return False The function has the right parameters, and returns a value of the right kind, but doesn't really do what it is supposed to do, yet. 3. Implement the test cases for the function in a Python file named a1q1 testing.py. Yes, do that before you implement the function! 4. Run your test program. Some, if not all, of the tests should fail, because you haven't implemented the function yet. That's exactly where you want to be. 5. Implement the function carefully. Then run the test program. Debug this function as necessary until all the tests pass. 5. Implement the function carefully. Then run the test program. Debug this function as necessary until all the tests pass. 6. Go on to the next function assured that your implementation of the current function is completely correct. Do not disable the testing of any function. Every test for every function you've written should be tried every time you add a new function. That way you know if you changed something for the worse. Because everyone is starting with the same design document, every program will have a high degree of similarity. That's perfectly okay. The value of this exercise is in the experience you gain from it, not the answer. What to Hand In - Your implementation of the program: a1q1.py. - Your test program a1q1_testing.py Be sure to include your name, NSID, student number, course number and laboratory section at the top of all documents. Evaluation - 5 marks: Your program a1q1 .py follows the design document given. - 5 marks: Your program a1q1 .py is well-documented with doc-strings describing parameters, and return values. - 5 marks: Your test program a1q1_testing.py includes all the test cases given in the design document. - 5 marks: Your test program a1q1_testing.py runs without producing any error. - 5 marks: Your program a1q1.py works as described above. Answer the following questions about your experience implementing the program in Question 1. You may use point form, and informal language. Just comment on your perceptions. Be brief. These are not deep questions; a couple of sentences or so ought to do it. 1. (2 marks) Comment on your program's correctness (see Chapter 3 of the textbook for the definition). How confident are you that your program (or the functions that you completed) is correct? What new information (in addition to your current level of testing) would raise your confidence? How likely is it that your program might be incorrect in a way you do not currently recognize? 2. (2 marks) Comment on your program's efficiency (see Chapter 3 of the textbook for the definition). How confident are you that your program is reasonably efficient? What facts or concepts did you use to estimate or quantify your program's efficiency? 3. (2 marks) Comment on your program's adaptability (see Chapter 3 of the textbook for the definition). For example, what if Assignment 2 asked you to write a program to check whether a 55 square was magic (bigger square with a larger sum, using the numbers 1 through 25)? How hard would it be to take your work in A1Q1, and revise it to handle squares of any size? 4. (2 marks) Comment on your program's robustness (see Chapter 3 of the textbook for the definition). Can you identify places where your program might behave badly, even though you've done your best to make it correct? You do not have to fix anything you mention here; it's just good to be aware. 5. (2 marks) How much time did you spend writing your program? Did it take longer or shorter than you expected? If anything surprised you about this task, explain why it surprised you. 6. (2 marks) Consider how often you were interrupted, distracted, delayed during your work for Question 1. Do you think these factors affected substantially increased the time you needed? If so, what kinds of steps can you take to prevent these factors

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions