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

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 LAST PAGE And make sure to answer ALL of its parts.

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 answet (will get a thumbs up) please otherwise I'll give dislike and report it to the Chegg authorities. Sorry for these words but 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 A102 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 wohose rows, columns and diagonals all sum to 15. On the right, is a 33 square of numbers whose rows columns and diagonals don thave the same sum. There are magic squares of all sizes (except 22 ), but well be corcrned 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 No 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 Mag icSquareDD. txt (available on Canvas), which is the end result of a fairly careful design process. It describes a collection of algorithms which, when used togtther 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 otherwise 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. Debg 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

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

Recommended Textbook for

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

13th Edition Global Edition

1292263350, 978-1292263359

More Books

Students also viewed these Databases questions