[SOLVED] CM10227/50258 Principles of Programming Coursework 1: SRPN

$25

File Name: CM10227/50258_Principles_of_Programming_Coursework_1:_SRPN.zip
File Size: 546.36 KB

5/5 - (1 vote)

CM10227/50258 Principles of Programming Coursework 1: SRPN
1 Saturated Reverse Polish Notation (SRPN) Calculator
Whilst performing some maintenance on a legacy system you find that it makes use of a program called SRPN (srpn). SRPN is not documented and no one seems to know who wrote it, so your boss tells you to rewrite it in Python.
SRPN is a reverse polish notation calculator with the extra feature that all arithmetic is saturated i.e. when it reaches the maximum value that can be stored in a variable, it stays at the maximum rather than wrapping around.
Your task is to write a program, which matches the function- ality of SRPN as closely as possible. Note that this includes not adding or enhancing existing features.
You have been proved with a repl.it link which allows you to run and interact with the srpn program. You should start by typing in the tests on the following pages, observe the output and them implement you code to replicate this functionality.
1

1. The program must be able to input at least two numbers and perform one operation correctly and output
Input:
10 2 + =
Input:
11 3 =
Input:
9 4 * =
Input:
11 3 / =
Input:
11 3 % =
2

2. The program must be able to handle multiple numbers and multiple operations
Input:
3 3 * 4 4 * + =
Input:
1234
2345
3456
d
+ d + d =
3

3. The program must be able to correctly handle saturation
Input:
2147483647
1
+
=
Input:
-2147483647
1

=
20 =
Input:
100000 0

d
* =
4

4. The program includes the less obvious features of SRPN. These include but are not limited to
Input:
1 +
Input:
10 5 -5 + /
Input:
11+1+1+d
Input:
# This is a comment #
1 2 + # And so is this #
d
Input:
3 3 ^ 3 ^ 3 ^=
Input: rrrrrrrrrrrrrrrrrrrrrrdrrrd
5

2 Submission Instructions
Your source (.py) files should be submitted in a single zip, with all files in the root of the zip: the file name should be of the form username-srpn.zip, e.g. abc12-srpn.zip.
If you have questions about this lab sheet, or are stuck with one of the questions, talk to the tutors in the lab or post your question on Slack or in the General Q&A forum on Moodle.
Please check Moodle for the submission deadline.
3 Marking Criteria
The coursework will be conducted individually. Attention is drawn to the University rules on plagiarism. While software reuse (with referencing the source) is permitted, we will only be able to assess your contribution.
Your code will, in part, be marked by code review. In this code review the key issues for assessing the quality of the the code will be: compiling, running with expected input, robustness (handling incorrect input), code design, and the algorithms being used. You stand to lose marks for repeated or badly structured or documented code. Marks will also be deducted for ill-named variables and functions, as well as for inconsistent indentation (see examples below for a guide).
3.1 Detailed Marking Criteria
Each question is marked out of 100%. The break down of the marks are as followed,
10% compiling code
40% running with expected/unexpected input
30% code design and algorithm used e.g. correct use of functions, return statements, well names functions and variable
10% commenting
The above marking allocation accounts for 90% of the marks. The final 10% is for completing two (2) code reviews. After you have submitted this coursework you will allocated 2 other students submissions and given a code review script. Submitting these code reviews, and verification that they are a fair reflection of the quality of the code being reviewed, will mean you are awarded the 10% of marks allocated for code reviews. If you do not submit, or your code review is incomplete or judged to be of low quality by the lecturer, then you will not be allocated these marks and your submission will be capped at 50%.
6

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] CM10227/50258 Principles of Programming Coursework 1: SRPN
$25