首页 > > 详细

48430编程设计辅导、c/c++程序调试、c++编程辅导辅导留学生 Statistics统计、回归、迭代|调试Matlab程序

48430 Assessment Task 2: Assignment
Please read and follow ALL submission requirements carefully.
Updates
If applicable, any updates to the assignment will appear here.
Resources
Sample executable employeelist_solution.out download
Source code template: employeelist.c download
Functionality of your program must be identical to the sample executable on Ed. When in
doubt run the sample to understand the requirements. See the Marking Criteria tab for more
information
Task Description
Data Engineers regularly collect, process and store data. In this task you will develop a
deeper understanding of how C programming language can be used for collecting, processing
and storing data. In this assignment you get the opportunity to build an interactive program
that can manage a list of employees in a company.
The list is stored as an array of employee_t type structures
employee_t employeelist [MAX_COMPANY_SIZE];
The employee_t is a structure typedef for struct employee. The struct employee contains the
following fields
• name - array of MAX_NAME_SIZE chars (string)
• fte - a float between 0.0 and 1.0
• birthday - a structure of date_t type as defined below.
The variable fte indicates if an employee works full-time or part-time for a company. The
value fte=1.0 (or 0.5) indicates that an employee works full time (or half-time) for the
company.
Note that we now have a struct nested within a struct. The birthday is a structure typedef
for struct date. The struct date_t contains the following fields,
• day - unsigned integer between 1 and 31 (inclusive)
• month - unsigned integer between 1 and 12 (inclusive)
• year - unsigned integer between 1800 and 2017
Your program interacts with the nested struct array in your memory (RAM) and simple
database file in your hard disk. It should provide the following features:
1. add employee
Add a new employee to the employeelist through the terminal. You should collect the input
by asking multiple questions from the user.
Enter name>
Enter birthday: day>
Enter birthday: month>
Enter birthday: year>
Enter FTE>
2. delete last employee
Remove the last employee from the employeelist. TIP: you cannot delete an element from an
array. Instead consider using an integer to keep count of number of employees.
3. display employee list
Display the list of employees in the following format as shown in the sample run. Please
follow the sample executable for the exact display format, including white spaces.
Name Birthday FTE
---------- ---------- ------
bee 10-01-1800 1.0000
Pay attention to the strict formatting guide:
• Name - left aligned, 10 chars at most.
• Date - 2 digit day, 2 digit month, 4 digit year
• FTE – 4 decimal places
4. save the employee list to the database file
Save the employeelist in the hard disk as a binary/text file named database. You may use
your own format to save the data. You should overwrite if database file already exists.
5. read the employee list from the database file
Read the database file and put the data into employeelist. You may only read the data files
created by your own program. You should overwrite the employeelist array you had in
memory when loading from the file.
6. exit the program
Exit the interactive program.
The database file
It is up to you to create your own data storage format for the database file. Your program
should be able to read the database that was created by itself. You can create the database as a
text or binary file.
You do NOT need to be able to create a database identical to the database of the sample
executable. You do NOT need to be able to read the database of the sample executable.
Your approach
First step for the assignment should be to read this specification very carefully. Then play
with the sample executable. Understand how it works, try different inputs. You will only
understand the task fully if you spend a reasonable time experimenting with the executable.
Breakdown the task into small measurable subtasks that can be achieved with functions, and
then implement one at a time. Begin by taking small steps. Create a program that does not
necessarily do all that is eventually required. Add to it slowly and methodically testing it on
each occasion. Do not try to write a program that meets all the requirements in one step - this
will not save you time.
TEST TEST TEST! Testing is a core part of programming. You should thoroughly test your
program to make sure the behaviour is identical to the sample executable. We will provide
you with test cases - think yourself. The more testing you do, higher your chances are to get a
good grade for the functionality.
If your program crashes unexpectedly, or it runs but does not give the correct output, then
you need to think of using a debugging strategy to determine the nature of the fault. For
example, you can place printf() statements at significant points in your source code to print
messages enabling you to trace execution of the program. You can also use comment
delimiters to temporarily remove parts of the source code from the compilation process.
You will lose marks if you do not follow the instructions in the template file. Do NOT hardcode
your solution.
When writing the code, the first step is to define the struct employee and struct date with the
fields mentioned above - do NOT add extra fields. Inside the main, you can define
the employeelist as an array of employee_t type - do NOT define this array as a global
variable. To start with, assume all user input is perfect (within the range, correct datatype).
Work on adding an employee, then on displaying the employeelist. You could then
progressively work your way through other features.
Do not worry about some months not having dates 29-31 and leap years. That means 30-02-
1900 is a real date, although the month of Feb does not have a day 30. Only the range
conditions mentioned before apply.
All strings in C should be null-terminated i.e. the last character should always be '\0'. The
name field in employee_t should be allocated MAX_NAME_SIZE number of chars.
However because the last character is '\0', the actual length of the name that can be stored
is MAX_NAME_SIZE-1. Example:
Enter name>Bee1 *Jayawickrama
The employee.name field will store only the first MAX_NAME_SIZE-1 (=10,
if MAX_NAME_SIZE is 11) characters including spaces and any other
character: {'B','e','e','1',' ','*','J','a','y','a','\0'}
Note that the database file is assumed to be error free. However, your program should
handle: “careless users” – a user may enter a value outside the expected range for any
interactive input. Example:
Enter your choice>0
Invalid choice.
Or a careless user may try to input 365 as the month the user was born (month should be
between 1 and 12). Or try to delete an employee when it is empty, etc.
I suggest initially attempt all features without worrying about careless users and having
spaces in names. Then build on top of that if you still have time in hand. Note that you are
expected to think yourself how a careless user could break your program - we will not
provide test cases.
NOTE: Handling spaces in name is aimed for advanced students. You may need to do your
own research, but more than that you may have to be creative. By using incorrect techniques
you could very well introduce more bugs in your code and it could be time consuming. The
special techniques required for this purpose are not examinable.
Marking Criteria
Criterion Weight
Following good coding practices 50%
Functionality of the program 50%
50% - following good coding practices
Follow the good coding practices listed under LAB01 Task 3. Your code will be manually
marked by tutors for the ability to follow this list of good coding practices. The coding style
will be checked in the Ed environment under default GEDIT configuration discussed
in LAB00 task 2.
To achieve marks for the good coding practices, your submission should not be trivial and
you need to attempt to address the task sufficiently. e.g. if the submission is a blank C
program that follows all applicable good practices listed in LAB01 Task 4, you will not
receive marks for good coding practices.
Rubrics for coding practices:
Criteria level 1 (1/3) level 2 (2/3) level 3 (3/3)
Commenting Level of commenting
is inappropriate.
Reasonable level
of commenting in
most parts.
Good level of
commenting,
explains the logic
behind the code
where necessary.
Indentation
Indentation is mostly
flawed, under the
default 48430 Gedit
configuration.
Indentation
appears mostly
correct, under the
default 48430
Gedit
configuration.
Indentation appears
correct, under the
default 48430 Gedit
configuration.
Code width
Code width mostly
does not follow 80
character limit
(common GNU
practice).
Code width is
above 80
characters in some
places (common
GNU practice).
Code width is 80
characters.
Variable/function
names
Names chosen for
variables, functions
and function
parameters are not
self-explanatory.
Names chosen for
variables,
functions and
function
parameters are
mostly selfexplanatory.
Names chosen for
variables, functions
and function
parameters are selfexplanatory.
Use of global
variables
Unnecessary usage of
global variables.
Unnecessary usage
of global variables
has been avoided.
Use of
preprocessing
directives
Pre-processing
directives such as
#define should be
used more.
Good use of #define
and other preprocessing

directives.
Use of predefined
library functions
Next to the #include
statements you
should list all
functions you use
from the libraries.
Correctly listed the
functions used from
the libraries next to
the #include
statements.
Breaking into
functions
Purpose of most
functions is not
specific enough.
Program has been
mostly broken into
sensible functions
with specific tasks.
Program has been
broken into sensible
functions with
specific tasks.
Function
descriptions
Function descriptions
are mostly
insufficient.
Function
descriptions could
better describe
"what" it does and
"what"
input/output
parameters are.
Function
descriptions provide
a good insight to
"what" it does and
"what" input/output
parameters are.
Passing variables
to functions
Read-only
arrays/pointers are
not passed with the
const keyword.
Where appropriate,
read-only
arrays/pointers are
passed with the
const keyword.
Usage of
structures
A new data type for
the structure has not
been defined using
typedef, and/or it
does not follow the
naming convention
ending with _t.
A new data type for
the structure has
been defined using
typedef, and it
follows the naming
convention ending
with _t.
The sum of above marks will produce 10/20 of the marks for this assignment (10% of the
grade in this subject).
50% - functionality of the program
14 Test cases will be used to mark the functionality, all tests carry equal marks and the total
marks out of 14 will be scaled to 10% of the grade in this subject i.e. (passed tests/14) *10 .
Functionality of your program will be checked by a series of automated tests done on Ed. The
outcome of each test could be:
• PASS - behaviour of your program is identical to the sample executable on Ed
• FAIL - behaviour of your program is different by at least one character
Ed has been configured as follows, until the deadline:
• You will know the PASS/FAIL outcome of each test immediately after
submission, allowing you to fix the program before the deadline.
• You have unlimited attempts to see the PASS/FAIL status of each test.
• Ed will NOT show the test inputs, and it will NOT show the diff comparison for
you.
• Think about possible test cases yourself and compare your solution with the
sample executable.
Ed has been configured as follows, 5 days after the deadline:
• Feedback show the failed test cases.
• No longer accepting submissions
Do NOT hardcode your answers. Tutors will manually check all the submissions. If you
hardcode your solution, tutors may change your functionality marks to 0.
NO exceptions to the above criteria will be made under any circumstances.
Compilation Requirement
We will include all compilation flags we have been using throughout the semester.
gcc -Wall -Werror -ansi -o employeelist.out employeelist.c -lm
We will compile your code on Ed as follows
gcc -Wall -Werror -ansi -o build/employeelist.out employeelist.c -lm
Your program must compile with NO errors and NO warnings on Ed. Failing this, Ed will not
run any of the functionality tests, hence you will receive 0 marks for the functionality. But we
will still mark the coding style.
Libraries Requirement
You are free to use the following C libraries in this assignment:
stdio.h
stdlib.h
string.h
You do not necessarily have to use all of them. However, you will receive 0 marks for the
functionality if you use any libraries other than those listed above.
Submission
Your submission will be via Ed. You should submit only one C file named employeelist.c.
Do NOT submit executable files, other file types, and other C files with different names.
You will get 0 marks for the assignment if this requirement is not met.
Due Date
The Ed submission link will show the deadline of the assignment.
Late Submissions
Standard FEIT late submission penalties apply - check the subject outline for more
information.
Feedback
You will receive the following feedback within 3 weeks of the due date:
• Overall mark for the assignment on Canvas Marks.
• Approximately 5-10 comments about the coding style on Canvas Marks.
• Outcome of automated functionality tests on Ed.
Request to Review
If you are confident that there are substantial irregularities in your marks, you may email the
lab tutors (not the subject coordinator) to lodge a request to review from your UTS student
email. This should be done no later than 1 week after releasing the results on Canvas.
Request to review could very well result in marks being left unchanged or even decreased if
we find that we have been too lenient.
Plagiarism
ALL work you submit must be your own. We take plagiarism very seriously. Why you
shouldn't plagiarise?
• This is an individual assignment.
• I will use plagiarism detection software to check that you did not copy parts of the
solution from previous submissions, other students in the class, online forums and
other online resources.
• If any submission has a high similarity from the plagiarism detection software, the
submission will be submitted as a misconduct case to university and the result of
this assessment and the subject will be withheld until the misconduct case is
resolved.
Tips
• Read the specification very carefully.
• Run the sample executable on Ed. You may need to setup file permissions. See
LAB01 Task 2.
• Breakdown the task into functions and implement one at a time.
• Do the exit program feature first. Then add employee and display employeelist
features.
• Do the complete assignment without considering the format of the careless users,
then think about it.
• Nested structure definition was covered in Forum 05 - Structures and file
processing.
• You will need to use a fixed size array with a maximum size to emulate a variable
sized array. The source code in Forum 04 - Arrays and strings has everything you
need for this.
• Do NOT define the employeelist array as a global variable.
• The assignment can be done without using pointers. But if you want to use
pointers, of course you can.
• Suppose you make a mistake in printing the choices menu. Instead of "6. exit the
program", you print "6 exit my program now". This message will be printed in
each test, hence you will fail all tests and receive 0 marks for the functionality of
your program.
• Submit to Ed early! It shows the outcome of each test case (Pass/Fail)
immediately.

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!