1336 Programming Assignment 1 Page 1 of 1 General Statement You must write this assignment starting with Template for Simple Programs (chapters 1-4).py. You earn up to 60% by correct operation and up...

Attach More File


1336 Programming Assignment 1 Page 1 of 1 General Statement You must write this assignment starting with Template for Simple Programs (chapters 1-4).py. You earn up to 60% by correct operation and up to 40% with good style, readability, and documentation. Refer to the Style Requirements.pdf document posted in Blackboard The Setup This is the classic “cat and mouse” game. Imagine a grid with a cat at one location (column, row) and a mouse at another location (column, row). Each one can move along a row from column to column by adding to or subtracting from its X value, and along a column from row to row by adding to or subtracting from its Y value. The cat wants to eat the mouse and the mouse wants to escape the cat. The Problem This program executes the simplest cat and mouse moves. The user inputs a column and row for the cat, and a column and row for the mouse, calculates the distance between them, and prints out their locations and the distance apart. Then the user inputs a move distance for each animal; the program adds the related distance to both the cat’s column and row, and the mouse’s column and row. Finally, the program prints the same information as above for the new locations. All numbers are integers. When calculating the distance you may end up with a decimal value: convert that result to an integer before displaying it. The formula for calculating distance is: distance = square root ( (cat row – mouse row)2 + (cat column – mouse column)2 ) You will need to use the exponentiation operator (**) with an exponent of ½ in order to get the square root necessary for the distance calculation. This is a simple example of using input, output, and calculations. Your success (read, score) depends as much on style as on getting the correct numbers. Special Notes: 1. Do not use repetitions, functions, lists, exceptions, or files, even if you know how to do those things. a. The purpose of this assignment is to see if you have the skills to use only the Python tools described in chapters 1-2 to solve this problem. The next assignment will require you to use repetitions and functions and you can show me your skills then. b. Using more advanced features demonstrates that you don’t know the simpler tools well enough, so using them will lower your score. 2. You earn up to 60% by correct operation and up to 40% with good style, readability, and documentation. Submit your solution (in Blackboard) as the file catAndMouse.py. Name the file exactly as given. Do not add anything to the program name. Not your name, not your ID number, not words like “assignment 1” or “revised”, or any additional characters as part of the file name. The Python program is scored with a maximum value of 100 points.
Sep 18, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here