Hello, I need help completing stage 3 of my assignment. I have already started it and just need help finishing it. Last week I had help with stage 2 and would like to have the same tutor. The...

1 answer below »
Hello, I need help completing stage 3 of my assignment. I have already started it and just need help finishing it. Last week I had help with stage 2 and would like to have the same tutor. The assignment is very similar to stage 2, except you are modifying it so that it reads the input file (parameter 1), storing all the records into a dynamic array in memory. The program should then sort the data records and write the output file (parameter 2) in sorted order. This is all done with c programming. I am using puTTY and you will need to use my username and password to login in and write the code in stage3.c the file I have already created. The instructions about the assignment is all in the PDF.


Copyright 2021 Macquarie University. Data File Lab – Assignment 1 COMP2100 Revised 24 August 2021 Richard Han, [email protected] This lab is the first of two assignments in COMP2100. Commences: Week 1. Progress: 10:30pm, Wednesdays of weeks 4, 5, 6, 7: 18, Aug, 25 Aug, 1 Sep, 8 Sep Due: 10:30pm, week 8: 15 September 2021 Value: 25% (16% for task, 4% weekly progress, 5% for code explanation) 1. Introduction This is the first of two programming task assignments in COMP2100. In this assignment, you will work with binary data stored in files, using the Unix I/O interface to read and write such files. The first part of this document describes the assignment (Data File Lab) in detail. Individual sections discuss an overview of the lab, how to fetch your personalised assignment specification, how you submit your work and obtain automatic feedback while you are working, and how the marking scheme works. The second part of this document describes each stage of the lab assignment. You should read this part to understand your task in each lab stage, and you should also refer to the personalised assignment specification for each stage. You obtain your personalised specification using the lab command. You should ensure that your personalised specification is kept secure at all times. You should also read the relevant support documents on iLearn in the section “Programming Task Support Notes”. The Lab Command Manual will enable you to perform key tasks including checking your marks and applying for free extensions – it is relevant to both assignments in this unit. There are documents that define what we expect in programming style, and support notes on C programming including some key ideas that are relevant to this Data File Lab. This document is Copyright © 2021 by Macquarie University. Neither this document nor any part of the assignment may be communicated to any unauthorised person or through any unauthorised service or website. 2. Overview of the Lab Data files exist in various formats. In Unix, text files are common for simple data, but large data files are stored as binary data. In this lab assignment (programming task), you will be developing programs to read, write, modify, and reformat the data in binary data files. The assignment consists of a sequence of stages which build on each other. The first three stages develop your skills. In the final stage you will reverse engineer a data file using your knowledge of data representations. You have the choice between an easier final stage (stage 4) that can earn you at most 3 marks for the stage, or a more difficult final stage (stage 5) worth up to 4 marks for the stage. You may attempt both stages 4 and 5, but only the maximum of the two marks will count towards your total. Copyright 2021 Macquarie University. The marking outline is: Section Value Stage 1 3 Stage 2 3 Stage 3 3 Stage 4 (max 3 marks) or stage 5 (max 4 marks) 4 Code style 3 Progress 4 Code comprehension 5 Total 25 Learning Outcomes This assignment will involve you in developing the following specific skills and capabilities.  Able to write programs that use C data structures, pointers and arrays.  Able to read and write binary data files, and write data in text format.  Able to convert between different data representations.  Able to use malloc and free to construct data structures using the heap.  Able to implement simple command line parameters.  Able to interpret and recognise binary data representations.  Research Unix library and system calls 3. Fetching your lab assignment The lab assignment files are accessed through the lab command which can be found at /home/unit/group/comp2100/lab There is no Unix man page for the lab command (it is not a Unix system command) but there is documentation on iLearn and if you don’t give it any command-line parameters or options then it will print out some brief documentation itself (a similar feature is common in many Unix programs). To see how this works, try the following command (where the $ symbol represents the Unix command-line prompt – you should type the command that is underlined in this example). $ /home/unit/group/comp2100/lab The option –g is used to get a lab stage. For example, to get lab 1 stage 1, do: $ /home/unit/group/comp2100/lab –g 1.1 For stage 2, the option would be –g 1.2 instead. Please see the Lab Command Manual in iLearn for more information about the lab command, including options for submitting assignments, getting marking reports, checking due dates and claiming your free extension days. Also, you can set up your Unix account so that you can abbreviate the command and just type “lab” instead of the full path name “/home/unit/group/comp2100/lab”. For the rest of this document, we will use the abbreviated name. The lab get command downloads your lab data as a tar file. For stage 1, the tar file is stage1.tar. Copyright 2021 Macquarie University. Tar is an archive utility (like zip) – it stores many files packed into one file. Use tar to extract the contents of this file. You can read all about tar in the Unix man page $ man 1 tar Here is the command to extract the contents of stage1.tar. $ tar xvf stage1.tar This will create a directory called stage1 and put the downloaded files in that directory. 4. Feedback during the assignment, submission and marking In this assignment, you can submit your code as often as you like, and receive immediate feedback and marks. There are rewards (progress marks) for working consistently throughout the assignment period and achieving stages of work by their due dates. Most of your final mark will be computed from the results of the automarker. A small number of marks are awarded for code style which is manually marked after the assignment closes. The maximum mark for the assignment is 20 marks. Of those marks, 13 marks are for achievements in the various stages, 4 marks are for progress and 3 marks are for code style. A. Introduction to COMP2100 automarking This is the first of two lab assignments in COMP2100. In both assignments, an automarker will track your progress and provide feedback to you. This is more than just telling you your mark – it is a feedback mechanism designed to help you as you work through the assignment. Firstly, the feedback is immediate, so when you think you have solved a problem you can submit your revised solution and see immediately whether it has enabled you to pass the automarker tests. Secondly, the automarker provides a detailed breakdown of your mark, which can help you isolate specific problems (such as a memory leak when using malloc and free). Thirdly, the automarker sometimes provides specific hints to help you understand what you need to address – such as identifying which columns of your data file are incorrect. You cannot rely only on the automarker, however. In this assignment, you will be provided with test data files, and you can and should compile your program yourself and run it on the test data files, examining the output yourself and identifying errors in your code. The automarker does not replace good old-fashioned debugging – one of the essential skills for all programmers. B. Individual work and information resources The stages of the lab are based on data files that will be provided to you. Each student will have their own specific data files to work with, with their own unique data format. This lab must be your own work. However, you may use resources on the Internet to obtain general information including information about the C language and libraries, information about binary and text data formats, and information about the operating system. If you obtain useful information from the Internet, you must include comments at the relevant points in your code acknowledging the source of the information (URL) and briefly describing the key idea(s) that you are using. (Exception: information from the Unix manual pages does not require citation in your program). The Unix manual pages are available online on ash and iceberg – use the man command. You can also find Unix manual pages online through Google. For example, to find out about the printf library call, use the command “man 3 printf” or Google “man printf” and to find out about the directory listing command ‘ls’, use the command “man ls” or Google “man ls”. However, you Copyright 2021 Macquarie University. should be cautious about using information found online because sometimes there are differences between different Unix systems and our systems may not behave exactly the same as described in some online documentation. The manual pages on the system (man command) are divided into sections: 1. System commands such as ls, wc, etc. 2. Unix system calls such as read(), open(), etc. 3. Unix library such as printf(), fopen(), etc. 4. Sections 4-8 contain other information. For more information on the man command, use the command “man man” to read the manual pages about the man command. C. Submitting your lab solution – achievement marks [13 marks] Your lab solution can be submitted using the lab command. The option –s is used to submit a solution to a lab stage. After the option, list all the files that you want to submit. Each time you submit, it is treated as a fresh submission, so you must list all the files that you want to submit every time. (If you find that tedious, learn about wildcards in the bash shell.) For example: $ lab –s 1.1 stage1.c sub.c defs.h The lab utility sends your submitted files to a server which compiles the C files together into a program, runs it, and tests that
Answered 3 days AfterAug 27, 2021

Answer To: Hello, I need help completing stage 3 of my assignment. I have already started it and just need help...

Ali Asgar answered on Aug 31 2021
141 Votes
#include
#include
#include
#include
#include
#include
struct strdef { /*strdef = structure definition*/
float sheet; /*32-bit floating point*/
ui
nt32_t condition; /*32-bit boolean*/
uint64_t ant; /*64-bit unsigned integer*//*hexadecimal converted to decimal number 457*/
uint32_t crack; /*32-bit integer*//*decimal value 47 converted to octal notation*/
uint32_t throne; /*32-bit integer*/
bool trade; /*8-bit boolean*/
bool cry; /*8-bit boolean*/
uint32_t pigs; /*32-bit boolean*/
uint32_t quartz; /*32-bit boolean*/
char wash[9]; /*at most 9-bit string*/
char industry; /*8-bit character*/
double pin; /*64-bit floating point*/
float doctor; /*32-bit floating point*/
int16_t plantation; /*16-bit integer*//*Convert from decimal to hexadecimal*/
uint8_t scarf; /*8-bit integer*//*decimal value 125 converted to octal notation*/
int8_t lake; /*8-bit integer*/
bool jump; /*8-bit boolean*/
};
struct stat statf;
int max_ele=1;
/*void printer(strdef arr)
{    for (int j=0;j     {    //arr[0]=rec1;
        printf("\nnumber: %d\n",j+1);
        printf("%f, %d, %lu, %lu, %u, %d, %d, %d, %d, %s, %c, %f, %f, %hx, %d, %hd, %d\n",
arr[j].sheet, arr[j].condition, arr[j].ant, arr[j].crack, arr[j].throne, arr[j].trade, arr[j].cry,
arr[j].pigs, arr[j].quartz, arr[j].wash, arr[j].industry, arr[j].pin, arr[j].doctor, arr[j].plantation,
arr[j].scarf, arr[j].lake, arr[j].jump);
}

}*/
int sort_sheet(const void * aa, const void * bb)
{
struct strdef a = *(struct strdef*)aa;
struct strdef b = *(struct strdef*)bb;
if (a.sheet==b.sheet)
{    if (a.ant==b.ant)    
{ if (a.pigs==b.pigs)    
{    if (a.industry==b.industry)    
        { if (a.pin==b.pin)    
         {    if (a.quartz==b.quartz)    
            { if (a.condition==b.condition)    
             { if (a.jump==b.jump)    
                { if (a.doctor==b.doctor)    
                 { if (a.throne==b.throne)    
                    { if (a.crack==b.crack)
                     { if (a.plantation==b.plantation)    
                        { if (strcmp(a.wash,b.wash)==0)    
                         { if (a.cry==b.cry)    
                            { if (a.lake==b.lake)    
                             { if (a.scarf==b.scarf)        
                                { if (a.trade==b.trade)    
                                     return 0;
                                 else if (a.trade <...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here