0% found this document useful (0 votes)
62 views8 pages

ASSIGNMENT 1 2020 (5%) : Cse1Pes: Programming For Engineers and Scientist S

The document provides instructions for Assignment 1 of the CSE1PES course. It outlines the submission requirements, including submitting the code for each task as a .c file by the due date. It also provides instructions for each task: Task 1 involves debugging compile errors, Task 2 debugging logic errors through test cases, and Task 3 implementing a small program as described in a text file. Guidelines are given for using Unix tools like cp and debugging code. Academic integrity and expectations for formatting, comments and constraints are also covered.

Uploaded by

Farrukh Abbasi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views8 pages

ASSIGNMENT 1 2020 (5%) : Cse1Pes: Programming For Engineers and Scientist S

The document provides instructions for Assignment 1 of the CSE1PES course. It outlines the submission requirements, including submitting the code for each task as a .c file by the due date. It also provides instructions for each task: Task 1 involves debugging compile errors, Task 2 debugging logic errors through test cases, and Task 3 implementing a small program as described in a text file. Guidelines are given for using Unix tools like cp and debugging code. Academic integrity and expectations for formatting, comments and constraints are also covered.

Uploaded by

Farrukh Abbasi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

CSE1PES: PROGRAMMING FOR ENGINEERS AND SCIENTIST S

ASSIGNMENT 1 2020 (5%)


Assignment developed by Matthew Felicetti 2016, updated 2017(MF), updated 2018(MF), updated 2019(MF), updated 2020(MF)

TOOLS
• Unix server through Putty for compiling and testing
• Notepad ++ for writing solutions
• LMS for submission

SUBMISSION

The task requires FOUR submissions:

• The code for task 1, task 2 and task 3


o Submitted as a .c file in the normal assignment submission portal.
o (Do not submit the executable.)
o There is NO late submissions for this assignment.
o Requests for extensions, need to be sent by email:
▪ Doctors certificates need to cover a period greater than 3 days, and not submitted less
than 3 days before the assignment is due.
▪ Special consideration will be rejected due to the assignment being worth less than
15%.
• The test cases as a pdf for task 2

DUE DATE AND TIME


See LMS

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>* .

replace <student_number> with your 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

Why is the destination a .


If you put a . as the second argument, it will take the name of the file/s you are copying

Downloading again will overwrite previous work

If you need to download a specific file

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

PART 1 – DEBUG THE COMPILE TIME ERRORS

Compile the code

<student_num>_assign1_task1.c

and you will find 3 or more compile time errors and/warnings.


Using your debugging skills and correct programming workflow, find and eliminate the errors and
warnings.
To use good program workflow, comment out sections of code and only address small sections at a
time.

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

PART 2 – DEBUG THE LOGIC ERRORS

STOP: READ THE ENTIRE QUESTION FIRST


The purpose of this task is for you to identify logic errors in a given piece of code.
If you remove those errors before testing the first time, you will lose marks.

Contains the expected logic of the code in text form.


This is what the code should do.

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.

Open the <student_num>_assign1_task2_description.txt in notepad++.

(DO NOT EDIT THE CODE IN THE TASK2 C FILE YET)

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.

The code is: <student_num>_assign1_task2.c

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.

Attempt to fix the code based on the previous testing

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

Note: Floating point error

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:

If you expect a value of 1328232.066666669


And the actual value is 1328232.125
This is an error of 0.00000439%
This is less than 0.00001% and so is considered a pass
Run 1: Before Fixing Logic Errors

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

Run 2: First Attempt Fixing Logic Errors

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

SMALL PROGRAMMING TASK

PART 1 – IMPLEMENT

Implement the code as described in the <student_num>_description_task3.txt

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

Use break minus 40% of final mark


Use goto minus 60% of final mark
Use conio.h or other headers minus 80% of final mark
Not correct assignment downloaded minus 100% of final mark

Task 1: Code Compiles 0 Does not compile 2 Attempted but 6 No errors


errors remaining
Task 2: Logic Test covers all 0 Does not cover all 1 test case missing 3 Covers all test
test cases test cases

Task 2: Test Run 1 matches 0 Does not match x 2 Matches


unchanged logic in code unchanged logic unchanged logic

Task 2: Test run 2 matches 0 Not attempted or x 1 Attempted and


changed logic in code not consistent consistent
Task 2: Final test run matches 0 Does not match x 1 Matches
expected logic logic expected expected logic
and code
Task 2: Code matches 0 Not implemented 2 Implemented with 6 Implemented
expected logic and is correctly small mistakes or correctly
implemented correctly poor practice
Task 3: Code is correctly 0 Not indented x 1 Indented
indented correctly (Any correctly
mistakes)
Task 3: Variables are named 0 Variables are given x 1 Variables
appropriately poor names given named suitably
the domain
Task 3: Description accurately 0 Does not reflect 1 Attempted but 2 Accurately
reflects code code or poorly poor reflects code
written
Task 3: 0 Implemented 1 Implemented 2 Implemented
if statements implemented incorrectly poorly correctly
correctly
Task 3: 0 Implemented 1 Implemented 2 Implemented
for loop implemented incorrectly poorly correctly
correctly
Task 3: 0 Implemented 1 Implemented 2 Implemented
format specifiers correct incorrectly poorly correctly

Task 3: 0 Many mistakes or 3 Small mistake/s 6 Correct


Output values are correct no output

You might also like