SIT172 Programming for Engineers - Assignments
Introduction
The following problem description will form the basis for all four assignments to be completed this trimester. Each assignment will require a different method to solve the same problem.
You will solve the problem using:
Spreadsheets
Pseudocode
C programming
Matlab programming
Problem Description
You are working as an Engineer for a agricultural research lab and have been asked to provide an automated solution to analyse data.
The data relates to a new method being developed to measure pH every 1m of an agricultural survey site and is stored in a file.
Each line in the file represents a row of measurements on the agricultural survey site. Data is separated by a comma ‘,’.
EG: Contents of data.csv
0.315176,5.953630,4.378064,2.260786,2.502727,5.920400,1.319211,8.379331,6.592940,9.743290,9.798430,8.939431,0.470454,0.963285,4.474396,7.432100,9.162240,5.706669,11.479737,10.057025,13.561091,7.438675,4.552040,1.478809,8.553421,10.903231,5.928341,1.271526,3.730601,2.151194,3.934074,6.161192,7.379998,6.403941,12.255202,7.252730,13.210717,8.927927,13.407715,3.369898,9.465712,4.046904,9.405314,9.731967,0.951899
The analysis is designed to determine if the method can detect soil acidity levels. The long term goal is to run extensive surveys of possible agricultural sites to measure, detect and determine the most suitable sites for farming. Also, the type of plant best suited for the quality of soil.
This unit introduces four methods that can be used to automate the analysis process. Each method has strengths and weaknesses. Regardless, by the end of the unit you will have a better understanding of these methods and which method suits particular types of tasks that you may be required to complete in industry.
The analysis that you are required to undertake consists of the following:
1. Preparation: perform the following changes to the data prior to classification and the search.
Round the data up to 2 decimal places
Check and identify any data that is less than 0 or greater than 14. If the data falls outside the range, convert the data to closest acceptable value. EG. 14.13342 => 14.0
2. Classification: The data is a measure between 0 and 14. Each value requires classifying according to the following ranges:
Where the value falls within the range, display the corresponding Display Value.
Range Display Value
0 - 2.8 1
2.8 - 5.6 2
5.6 - 8.4 3
8.4 - 11.2 4
11.2 - 14.0 5
The resulting information will look something like the following:
1 4 4 4 3 4 3 1 5
1 4 1 1 5 1 5 2 2
4 5 2 2 3 2 4 1 4
3 5 2 5 2 5 4 4 2
3 2 4 3 5 3 5 5 1
5 2 3 3 2 2 5 3 3
1 2 1 4 1 2 1 5 3
5 1 1 1 2 3 5 3 3
4 1 4 5 5 5 4 2 3
4 3 3 2 3 5 5 1 1
2 3 1 4 3 1 4 4 2
5 1 1 4 3 5 5 4 3
4 2 5 3 3 1 1 5 1
2 3 5 4 1 2 5 5 1
2 1 5 2 5 5 5 3 3
4 2 4 1 2 4 4 3 5
Note: The above image is for demonstration purposes only, and is not a 100% reflection on how your map should look. Do not use it as a reference for your own solution, as yours will look different to this one.
Provide a count of each of the Classification values.
Range Display Value Count
0 - 2.8 1 30
2.8 - 5.6 2 65
5.6 - 8.4 3 24
8.4 - 11.2 4 67
11.2 - 14.0 5 34
Note : This is an example only and does not represent the final search map you will produce.
3. Pattern Search : The engineers are interested in identifying any areas that represent a cluster of a particular type. The next phase is to search the Classification Map and identify the following clusters:
# represents the value found at that location that matches the search.
Pattern A :
# # #
# # #
Pattern B:
# #
# #
# #
Pattern C:
# #
# #
The search should result in a Search map indicating where the search identified a pattern.
For this exercise the pattern search need only record the first pattern found.
#A identifies Pattern A was found of value #
#B identifies Pattern B was found of value #
#C identifies Pattern C was found of value #
#A
#C #C
#A
#B
#A
Note : This is an example only and does not represent the final search map you will produce.
Report the number of times the patterns are detected.
Range Display Value Count Pattern Count Pattern A Count Pattern B Count Pattern C Count
0 - 2.8 1 30 3 1 0 2
2.8 - 5.6 2 65 6 6 0 0
5.6 - 8.4 3 24 2 1 1 0
8.4 - 11.2 4 67 8 2 4 2
11.2 - 14.0 5 34 2 2 0 0
Note : This is an example only and does not represent the final counts you will produce.
Assignment 1: Spreadsheets (10%):
Due - End of week 5 (5:00pm 7th April)
Description
Using a spreadsheet program such as Microsoft Excel, complete the following analysis:
Download data-1.csv from the unit website
Read the data file into a spreadsheet program
Name the worksheet Data
o Convert and check the data in the Data worksheet.
o Create a Classification Map, then determine and display the value for each cell as per the problem description (use Conditional Formatting in Excel to highlight the unique values in the map)
Create and display the results of Pattern Search.
Calculate and display the counts as per the specifications
Additional notes:
Ensure you provide a table that reflects the Range and Value used to create the Classification Map. The user should be able to change the range and associated value and have the change propagate through the map accordingly.
Ensure that your information/results have been communicated clearly. This includes displaying the counts, having a legend, using Conditional Formatting to highlight values in colour, and so on.
Ensure that classification and Pattern Maps are easy to understand. A map and a legend is a must here. Clearly showing the results of your counts, the location of patterns, and the result of the rule, are all essential for communicating to the reader effectively.
Ensure you use appropriate and efficient relative and absolute addressing in your design. I may wish to change the symbols used to reflect the outcomes to ‘#,*, $’ instead of ‘1,2,3,4,5’ and as a consequence I should only change this in one cell to reflect the change throughout the spreadsheet.
Marking guide (10 points)
Raw data processing:
Final values rounded up and checked correctly for each row and column: 1.0
Classification Map:
Map correctly created with accurate values and formatting: 3.0
Appropriate use of Absolute & Relative addressing: 0. 5
Clear legends and tables used: 0.5
Pattern Map:
Results of rule are correctly calculated and accurate for each row/column: 3.0
Appropriate use of Absolute & Relative addressing: 0.5
Clear legends and conditional highlighting used: 0.5
Value and Pattern counts
Counts provided and accurate : 1.0
Submission instructions:
Please submit a single Excel file, with an extension of either .xls or .xlsx, to the assignment dropbox by the due date. Your name and student ID must also appear within the Excel file.
Assignment 2: Pseudocode (10%)
Due - End of week 7 (5:00pm 28th April)
Using appropriate pseudocode syntax, write the algorithm required to describe the steps involved to analyse and display the data as per the problem description.
The order of the algorithm should be as follows:
Variables
Describe the data requirements, variables etc
Algorithms
Describe the process to store the value for each row and column for an unknown number of rows and columns
Describe the process to determine and store the values for the Classification Map
Describe the process for calculating and displaying the results of the Pattern Map.
Describe the process to calculate and display the counts as per the specifications
Additional notes:
Ensure you use appropriate and efficient use of variables and constants in your design. I may wish to change the symbols used to reflect the outcome to ‘#,*, $’ instead of ‘1,2,3,4,5’ and as a consequence I should only change this in one cell to reflect the change throughout the code.
Clarity and readability are absolute key for this assignment! If your submission is hard to follow the marker will ultimately miss important information and you will lose marks. Make it readable.
Marking guide (10 points)
Raw data processing:
Variables and constants defined and initialized: 0.5
Code defined to roundup and check the data: 1.0
Classification Map:
Code defined that uses IF statements correctly to compare the cell with Range: 2.0
Code defined that correctly stores the Classification Map: 1.0
Code defined to correctly display the Classification Map: 0.5
Pattern Map:
Code defined to search and identify patterns as per the specifications : 2.0
Code defined that correctly stores the Pattern Map: 1.0
Code defined to correctly display the Pattern Map: 0.5
Counts:
Code defined to display the counts : 1.0
Code formatting and comments are appropriate and well laid out: 0.5
Submission instructions:
Please submit a single text file, with an extension of .txt, to the assignment dropbox by the due date. Do not worry about losing your ''colouring" as NotePad++ will automatically re-apply them when it comes time to mark your submission. Your name and student ID must appear in comments at the top of your file.
Assignment 3: C Programming (15%)
Due - End of week 9 (5:00pm 12th May)
For help getting started with this Assignment 3 (eg. creating a Visual Studio or XCode project), please see the Appendix A at the end of this document.
Using appropriate C syntax, write the code required to analyse and display the data as per the problem description.
The order of the C Program should be as follows:
Variables and constants:
Use #define statements to define the constants
Use arrays to store the data, maps and counts
Read data:
Download data-1.csv from the unit website
Read each individual data item from the file using an appropriate method into a two dimensional array
Close the file when finished
Algorithms
Describe the process to transform and store the value for each row and column for an unknown number of rows and columns
Describe the process to determine and store the values for the Classification Map
Describe the process for calculating and displaying the results of the Pattern Map
Describe the process to calculate and display the counts as per the specifications
Additional notes:
Code commenting and formatting is extremely important, and makes a big difference in the readability and understandability of your code. This will be taken into account when marking.
Ensure you use appropriate and efficient use of variables and constants in your design. I may wish to change the symbols used to reflect the outcome of ‘#, *, $’ instead of ‘1,2,3,4,5,6,7’ and as a consequence I should only change this to reflect the change throughout the code.
Marking guide (15 points)
Raw data processing:
Variables and constants defined and initialized: 1.0
Code defined to roundup and check the data: 1.0
Classification Map:
Code defined that uses IF statements correctly to compare the cell with Range: 2.0
Code defined that correctly stores the Classification Map: 1.0
Code defined to correctly display the Classification Map: 1.0
Pattern Map:
Code defined to search and identify patterns as per the specifications : 4.0
Code defined to correctly stores the Pattern Map: 1.0
Code defined to correctly display the Pattern Map: 1.0
Counts:
Code defined to store and display the counts : 2.0
Code formatting and comments are appropriate and well laid out: 1.0
Submission instructions:
Please submit just your code file (and not the entire project) to the assignment dropbox by the due date.. Your code file is the file that you have written all of your code in, and it will have an extension of .cpp or .c. It can be found in the folder where you have saved your Visual Studio or XCode project. Your name and student ID must appear within comments at the top of the file.
Assignment 4: MatLab Programming (15%)
Due - End of week 11 (5:00pm 26th May)
If you do not own a copy of Matlab but wish to work from home, you must Remote Desktop in to use the Matlab copies supplied on the Deakin network. Instructions on how to connect to the Remote Desktop can be found under Appendix B at the end of this document.
Using appropriate MatLab syntax, write the code required to analyse and display the data as per the problem description.
The order of the MatLab Program should be as follows:
Variables and constants:
Use arrays to store the data, maps and counts
Read data:
Download data-1.csv from the unit website
Read each individual data item from the file using an appropriate method into a two dimensional array
Algorithms
Describe the process to transform and store the value for each row and column for an unknown number of rows and columns
Describe the process to determine and store the values for the Classification Map
Describe the process for calculating and displaying the results of the Pattern Map
Describe the process to calculate and display the counts as per the specifications
Additional notes:
Code commenting and formatting is extremely important, and makes a big difference in the readability of your code. This will be taken into account when marking.
Ensure you use appropriate and efficient use of variables and constants in your design. I may wish to change the symbols used to reflect the outcome of ‘#, *, $’ instead of ‘1,2,3,4,5,6,7’ and as a consequence I should only change this to reflect the change throughout the code.
Marking guide (15 points)
Raw data processing:
Variables defined and initialized: 1.0
Code defined to roundup and check the data: 1.0
Classification Map:
Code defined that uses IF statements correctly to compare the cell with Range: 2.0
Code defined that correctly stores the Classification Map: 1.0
Code defined to correctly display the Classification Map: 1.0
Pattern Map:
Code defined to search and identify patterns as per the specifications : 4.0
Code defined to correctly stores the Pattern Map: 1.0
Code defined to correctly display the Pattern Map: 1.0
Counts:
Code defined to store and display the counts : 2.0
Code formatting and comments are appropriate and well laid out: 1.0
-------------------------------------------------------------------------------------------------------------
Appendix A - Getting Started with Assignment 3
To begin Assignment 3 you will either need to use Visual Studio (PC), or XCode (Mac). Below you will find some help information on how to start a project in either, and how to use the starting code that is provided for you.
Don't forget to start with the code provided to you, found in 'ass3.c' under Assessments.
Using Visual Studio for PC: Here are some basic guidelines to help you get started when using Visual Studio. Note that any version of Visual Studio will suffice, and you can download a free version of Visual Studio Express from the Microsoft website (do a quick Google search). Be sure to download the Visual Studio Express for Windows Desktop version!
1. Open up Visual Studio, select File, New, and Project. A window will appear with a multitude of different templates you can begin with to help you get ready to code faster.
2. With C programming our focus for this unit, we would like to begin with a Visual C++ template. Please note that C++ is a different language to C, however they can both use the same compiler so it will suffice for our purposes to help us get started.
3. Inside the Visual C++ option, we want to select a Win32 Console Application. This option allows us to omit any files that deal with graphical user interfaces (GUI) as we are not concerned with them for this unit. Give your project a name, and specify where to save it.
4. In the wizard that appears next, we want to ensure that 'Empty project' and 'Precompiled header' are both unchecked. This allows us to get up and running a lot quicker by only providing us with the template files and code that we are concerned with.
5. Highlight the code found in ass3.c (found under Assessments) and Copy it, now Paste this code over the code that was provided in the template.
6. Browse to where on your PC you have saved your project to, and find where your main .cpp file is. (eg. My project was called 'assignment3' so I need to browse into my project folder until I found 'assignment3.cpp'). Copy our raw data file 'data-1.csv' into the same folder that has your .cpp file.
Using XCode for Mac: If you must use a Mac then I would recommend using XCode. This is free, and can be obtainable from the Apple's development website (a quick Google will point you to the right website).
1. Open up XCode and choose to create a new project. In the next window select Application (under OS X), and Command Line Tool.
2. Give your project a name under Product Name, and ensure Type is set to C. Press Next, and select where you would like to save your project.
3. Highlight the code from the Assignment 3 getting started code provided and Copy it, now Paste this code over the code that was provided in the template.
4. On the left-side panel you will see some folders and files. Open up the folder titled 'Products', and right-click on the file inside (which will be the same name as the name you gave your project, like ass3). Select 'Show In Folder' and a window will open. Copy our raw data file 'data-1.csv' into this folder.