ASSIGNMENT 1 2020 (5%) : Cse1Pes: Programming For Engineers and Scientist S
ASSIGNMENT 1 2020 (5%) : Cse1Pes: Programming For Engineers and Scientist S
TOOLS
• Unix server through Putty for compiling and testing
• Notepad ++ for writing solutions
• LMS for submission
SUBMISSION
There is NO late submissions for this assignment. No assignment will be accepted after the due date,
without a legitimate extension granted by the subject coordinator before the due date.
ACADEMIC INTEGRITY
Plagiarism is the submission of somebody else’s work in a manner that gives the impression that the
work is your own. For individual assignments, plagiarism includes the case where two or more students
work collaboratively on the assignment. The School of Engineering and Mathematics treats plagiarism
very seriously. When it is detected, penalties are strictly imposed.
http://www.latrobe.edu.au/students/academic-integrity
PRELIMINARY TASK – DOWNLOAD THE CODE PACKAGE
On Unix, create a directory named 'assignment_1' if you have not done so already (see lab0)
Change into this directory
Copy the files using the command below:
cp ~csilib/cse1pes/students/assign1/<student_number>* .
What is cp?
cp is the copy command in Unix
The first argument is the source and the second the destination
cp source destination
cp ~csilib/cse1pes/students/assign1/<student_number>_assign1_task1.c .
cp ~csilib/cse1pes/students/assign1/<student_number>_assign1_task2_description.txt .
cp ~csilib/cse1pes/students/assign1/<student_number>_assign1_task2.c .
cp ~csilib/cse1pes/students/assign1/<student_number>_assign1_task3_description.txt .
TASK 1
DEBUGGING
<student_num>_assign1_task1.c
https://youtu.be/uu2jADfFVEM
Do not fix the logic. This is important to know that you can differentiate the syntax errors and logic
errors. This ensures that you are not guessing and will be tested in Task 2.
TASK 2
assign1_task2_ description.txt
Contains code that has attempted to implement the expected logic, but has
logical errors.
The logic errors must be reported in the test case tables before any
changes are made.
assign1_task2.c Once logic errors are identified, then the code can be edited and the test
cases must be repeated.
Step 1.
Write 8 test cases using the template found on LMS (Test cases.docx)
You need to specify both the inputs and expected values.
You need to cover all possible cases to fully evaluate the code.
Step 2.
Test the code at this stage (Run 1) and report the actual values, before editing
(You will need GDB or printf to get the value of input1, input2 and temp)
You should find some of actual values may match the expected and others may not.
Highlight the actual values that do not match in RED
See guide on LMS for help if you are not familiar with basic testing
Step 3.
Test the code again (Run 2), against the exact same test case.
If you find any actual values that do not match, highlight them in RED
Step 4.
Continue testing until all test cases are correct. You do not need to use all runs
As floating point number are stored within a fixed amount of space, 32 -bits, real numbers cannot
always be accurately represented. (There are ways to mitigate this, but this is not the purpose of the
task)
Given your calculator generally uses larger types to calculate, the value will likely be more accurate on
your calculator.
If you have an error less than 0.00001%, then you can accept this as being a pass.
|𝑎𝑐𝑡𝑢𝑎𝑙 − 𝑒𝑥𝑝𝑒𝑐𝑡𝑒𝑑|
𝐸𝑟𝑟𝑜𝑟 𝑃𝑒𝑟𝑐𝑒𝑛𝑡𝑎𝑔𝑒 = ∗ 100
𝑒𝑥𝑝𝑒𝑐𝑡𝑒𝑑
For example:
Test User User Expected Actual Expected Actual Expected Actual Expected Actual
Number Input Input value of value value of value value of value value of value
input1 input2 input1 of input2 of temp of output of
input1 input2 temp output
1 5 6 5 6
Test User User Expected Actual Expected Actual Expected Actual Expected Actual
Number Input Input value of value value of value value of value value of value
input1 input2 input1 of input2 of temp of output of
input1 input2 temp output
1 5 6 5 6
8
TASK 3
PART 1 – IMPLEMENT
You must use at least one for loop and at least one if statement to complete this task or no marks will be
awarded.
Make sure to read the constraints below
CONSTRAINTS
• Formatting needs to be as specified. (Your program will be tested against automated test cases)
• Text to user needs to be easily understandable.
• The program must print your student number as specified.
• Types should be used appropriately.
• You do not need to use functions (You will not lose marks if you don’t or do).
• You must use comments to explain significant lines of code.
• The code must be done using ANSI C and compile on latcs5.cs.latrobe.edu.au using gcc
• You must not use break or goto in the assignment
• You are only allowed to include the stdio.h header file. No others. Do not use conio.h
RUBRIC