Write a trivial python function that does nothing

Assignment Help Computer Engineering
Reference no: EM131558344

Principles of Computer Science Assignment-

Background

In this assignment, you'll be working with two related but distinct problem domains. Read this material carefully.

Question 1 -

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. To establish the standards of documentation and testing for CMPT 145.

Degree of Difficulty: Moderate. Don't leave this to the last minute.

In this question you will implement a program that does the following:

  • It asks the user for a sequence of 9 numbers. The order of the numbers is important, as the rows of the grid use this order.
  • It checks whether the sequence of numbers 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.

We've given you a design document called MagicSquareDD.txt (available on Moodle), which is the 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.

It's a top-down design, and algorithms are presented in the order they were designed. In a top-down document, it is common for a function to be called before the algorithm is given; this is the opposite of the order that Python uses. You should not implement the program "top-down." A good rule of thumb is this: "Design top-down. Implement bottom-up." It's not a hard and fast rule, but it's a good guide.

For every function in the program, you are to write testing for it. Your approach should be as follows, for each function you implement:

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.

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. Your function could also return None, or some other value.

3. Design a number of test cases for the function based on the information in the design document. Yes, do that before you implement the function! Implement the test cases in a Python file named a1q1_testing.py.

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.

6. If you taken the time to design your tests carefully, you can 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. The value of this assignment is the experience you gain from doing it. Hopefully, you will agree that a good design makes implementation fairly easy. Hopefully, you will see the earmarks of a thorough (if not high quality) design.

Question 2 -

Purpose: To reflect on the work of programming for Question 1.

Degree of Difficulty: Easy.

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; you do not have to give really deep answers. Be brief. These are not deep questions; a couple of sentences or so ought to do it.

1. Comment on your program's correctness. 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. Comment on your program's efficiency. 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. Comment on your program's adaptability. For example, what if Assignment 2 asked you to write a program to check whether a 5 x 5 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. Comment on your program's robustness. 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. How much time did you spend completing this assignment? If you had to solve this problem without the given design document, how much longer (or shorter) do you think it would have taken you to complete, start to finish? Would you have been as con dent in your program's correctness?

Question 3 -

Purpose: To build a program and test it, starting without a design document. This is an exercise to contrast with Question 1.

Degree of Difficulty: Moderate. Don't leave this to the last minute.

In this question you will implement a program that checks whether a N x N square of numbers is a Latin Square or not (see the Background section for the definition). Your program should work by reading input from the console, and sending an answer to the console, as in the following example:

  • It reads a number N on a line by itself. This will be the order of a Latin square. The order must be a positive integer, e.g., N > 0.
  • It reads N lines of N of numbers, i.e., it reads console input for a square of numbers.
  • It checks whether the sequence of numbers is a Latin square or not. Your program should display the message "yes" if it satisfies the above criteria, or "no" if it does not.

Question 4 -

Purpose: To reflect on the work of programming for Question 3.

Degree of Difficulty: Easy.

Answer the following questions about your experience implementing the program in Question 3. You may use point form, and informal language. Just comment on your perceptions; you do not have to give really deep answers. Be brief. These are not deep questions; a couple of sentences or so ought to do it.

1. Comment on your program's correctness. How confident are you that your program (or the functions that you completed) is correct?

2. Comment on your program's efficiency. How confident are you that your program is reasonably efficient?

3. Comment on your program's reusability. For example, did you re-use any code from a different project (maybe Q1)? How easy would it be to re-use any part of your program for another task?

4. Comment on your program's robustness. 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.

5. How much time did you spend completing this question? Compare the time you spent on Q3 with the time you spent on Q1.

Attachment:- Assignment Files.rar

Reference no: EM131558344

Questions Cloud

Do you support drug legalization if so which drugs why : Do you support drug legalization? If so, which drugs? Why? What are the pros and cons of drug legalization? Be sure to support your opinion with sources.
What is the annual interest rate : What is the annual interest rate if the hospital pays on the 16 and on the 30th day?
Education and intellectual functioning : Select two of the factors listed above and explain in detail how they may affect your approach in interviewing and assessing a victim.
What is the yield to call of the bond : The call premium is one year of coupon payments. It is offered for sale at $1,115.25. What is the yield to call of the bond?
Write a trivial python function that does nothing : CMPT 145 Winter 2016-17 Principles of Computer Science Assignment. Write a trivial Python function that does nothing, but has the correct name
What yield to maturity is the bond offering : A 6.00 percent coupon bond with 18 years left to maturity is offered for sale at $946.52. What yield to maturity is the bond offering?
How does the author analyze the word or phrase : How does THE AUTHOR analyze the word or phrase? How does the author use comparison or details? Notice I'm not asking about the CONTENT of the piece.
Describing the assessment tools you will use : A description of the steps you will take to build rapport with Laurel and help her feel comfortable in confiding in you.
How have new banking laws influenced competition : How have new banking laws influenced competition and what is the prime interest rate? How does the average bank customer fare in regard to the prime interest rate?

Reviews

len1558344

7/8/2017 8:36:08 AM

This assignment is individual work. You may discuss questions and problems with anyone, but the work you hand in for this assignment must be your own work. Each question indicates what to hand in. You must give your document the name we prescribe for each question, usually in the form aNqM, meaning Assignment N, Question M. Make sure your name and student number appear at the top of every document you hand in. These conventions assist the markers in their work. Failure to follow these conventions will result in needless effort by the markers, and a deduction of grades for you. Do not submit folders, or zip files, even if you think it will help.

len1558344

7/8/2017 8:36:00 AM

Programs must be written in Python 3. Assignments must be submitted to Moodle. There is a link on the course webpage that shows you how to do this. Moodle will not let you submit work after the assignment deadline. It is advisable to hand in each answer that you are happy with as you go. You can always revise and resubmit as many times as you like before the deadline; only your most recent submission will be graded. Read the purpose of each question. Read the Evaluation section of each question.

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd