Assignment1 Programming
Assignment1 Programming
School of Computing
Programming Assignment
Programming 1 4CC510
Task
Throughout the opening five weeks of this module, we cover the fundamentals required for
imperative and procedural-based programming. This can be broken down into the core topics of
the Programming I syllabus:
-
We will now explore all of these topics within the confines of a specific exercise that utilises all
programming skills you have learned thus far.
Note: Upon first reading this document, it might not be immediately clear how to proceed with this
assessed component. If this is the case, there is no need to panic: while it may not be obvious at
first, all of the learning material required to cover this assignment is provided in the first four
weeks of the module. Attendance in lectures during this period, as well as reading the provided
material and trying your hand at the practice exercises will prepare you adequately for this
exercise.
My First Calculator
Undoubtedly one of the first computation-based device many people use as part of their schooling
is a calculator. While we may not consider them as such, calculators are computational devices and
require programming for them to work. As such, your task is to build a mixture of both basic and
advanced programming functions to run via a console prompt.
In an effort not only to formalise the assessment process, but also given some guidance, sample
code is provided for this assessed component on Course Resources.
Programming 1 4CC510
Basic Functions
-
double Subtract(double, double): Taking two numbers, calculate the subtraction between
the two.
o Is called when the - character is used in Calculate.
Programming Assignment
Programming 1 4CC510
double Divide(double, double): Returns the product of dividing the first number by the
second.
o Is called when the / character is used in Calculate.
Advanced Functions
-
int Factorial(int): Taking in a non-negative integer, calculate the Factorial of the number:
the product of all positive integers less than or equal to it.
o Is called when the ! character is used in Calculate.
o Note: ! is a terminal character and will end the current calculation.
double Power(double, double): Calculates the first number to the power of the second
number.
o e.g.: Power(2,3) will return 8, given 8 is 23.
o Is called when the ^ character is used in Calculate.
o Note: There is existing code in the C# language to calculate numbers to a specific
power.
Part 3 Testing
As part of this assignment, a sample solution, complete with the starting code for Calculate and
Add is available from week 3 of the semester. Allowing you four weeks to ensure your code is
compliant with this test solution.
In this solution, you can run your code in specific circumstances thousands of times, to ascertain
how effective it is in certain problems. The sample version released will test a large number of
combinations of values and basic functions, resulting in a total success rate. The total success rate
of these tests will be displayed on screen when you run the solution as well as indicating the
success rate of specific test types (Additions, Subtractions etc.) You can then use this to focus on
what parts of the code base are not working correctly.
Note that the solution provided does not handle testing for advanced functions. Should you wish to
test these it is your responsibility to write this test code.
A final testing solution, in which you should copy your Calculator.cs file, will be made available in
week 6. This is the final testing solution that you must submit your calculator in. The total success
rate, as indicated by this final testing solution, will account for 80% for this assessed component,
with the final 20% an assessment of your coding style. This will be achieved by scoring you against
Programming Assignment
Programming 1 4CC510
a range of basic and advanced functions as well as combinations of the two in the same
mathematical expression.
Naming Conventions: Adequate choice of variable and/or method names. Method names
fit that dictated by the specification. Additional methods/variables not dictated by
specification or sample solution are named using camelCase format.
Indentation: Code is properly and allows for ease-of-reading and understanding.
Parenthesis: Appropriate use of brackets and braces where needed. No extraneous
brackets/braces found within the code.
Line-Spacing: One statement/declaration per line, with one blank line between methods.
Please consult the MSDN document on C# programming style and examples provided from
lectures for further guidance.
Part 4 Submission
Completion of this component will be achieved courtesy of an assessment submission point that
will be made available in the Course Resources site for Programming I in week 6 of the semester.
In order to be graded for this submission, the following conditions must be satisfied:
1. The final solution, detailed in Part 3, complete with your Calculator.cs, must be submitted
to the online submission point no later than 23:59pm on the Monday of Week 7 (i.e. 2nd
November 2015).
2. The student must attend their designated tutorial slot on the Tuesday of Week 7 (3rd
November) to participate in the grading process.
3. Student must then present their submission by downloading it from the Course Resources
submission point: allowing for an assessment of style, in addition to running the
performance tests in the code.
4. Student must also be able to answer questions on their work at the assessors discretion.
Failure to satisfy this criteria will result in a failing grade being attributed to this component.
Programming Assignment
Programming 1 4CC510