1. Homepage
  2. Programming
  3. CE4703 Computer Software 3 - Assignment #1: Array of Integers

CE4703 Computer Software 3 - Assignment #1: Array of Integers

Engage in a Conversation
LimerickCE4703Computer Software 3ED5071Computer Engineering FundamentalsC++Python

CE4703 Computer Software 3 ED5071 Computer Engineering Fundamentals CourseNana.COM

Assignment #1 CourseNana.COM

Dr Reiner Dojen 1
Due 11:00h on Thursday, 09.11.2023 CourseNana.COM

1reiner.dojen@ul.ie CourseNana.COM

CE4703/ED5071 Assignment #1 CourseNana.COM

1 Overview CourseNana.COM

Your task is to develop a program that can create and anlyse arrays of integers in various ways. While developing the program, you must follow the principle of modular programming (I also strongly encourage to re-use code as much as possible). Also, for any non-trivial function, you must follow the 7 Steps of Systematic Program Construction. Furthermore, you must comment all your code for Doxygen. CourseNana.COM

All code must be developed as a Microsoft Visual Studio (VS) project using standard C. CourseNana.COM

You also need to construct a report (in plain text format - just add a text file named after you student ID to your VS project) that contains the following: CourseNana.COM

A list of modules that make up your program. CourseNana.COM

For each module, list what functions it contains. Also, provide a function prototype (i.e. a function declaration) for each function. CourseNana.COM

Specification for each function. CourseNana.COM

Pseudocode representation for each function. For simple functions, a single iteration is sufficient - for any non-trivial function pseudo-code represen- tation provide (at least) two iterations of refinement. As discussed in the lecture, I recommend to also include your pseudo-code as “in-code” com- ments in your source files. CourseNana.COM

Modular Structure CourseNana.COM

Your program must implement the functions listed below in Section 2.1 Required Functions. Before you start implementing these functions, you must design a modular structure - that is, define the modules that will make up your program. For each module, decide what functions it contains. CourseNana.COM

2.1 Required Functions CourseNana.COM

You must provide a function for each of the listed tasks below. Feel free to implement additional functions. CourseNana.COM

Page 1 of 7 CourseNana.COM

CE4703/ED5071 Assignment #1 CourseNana.COM

Note: For this assignment, arrays distinguish between “used” and “unused” ele- ments. This means, that the size (or capacity) of an array indicates the maximum number of elements that can be stored in the array. However, not all elements may be “used” - in the extreme case, nothing is stored in an array: That is, while an array may have 20 elements, none of these are used to store a value. Thus, you somehow need to find a way to store values in the array in such a way that you can distinguish between “used” and “unused” array elements (various ways are possible, e.g. you can use a marker value that is stored in “unused” locations or you can use a secondary array to indicate which locations are used and which are not used (other methods do exist)). CourseNana.COM

Any function that takes in an array needs to be aware of this distinction - for example, the function to compute the average value should only consider “used” elements and ingore “unused” elements. CourseNana.COM

  • Return a random positive integer number. Use the standard library function rand to generate these numbers - use the same range as rand(). Feel free to seed the random number generator. CourseNana.COM

  • Return a random integer number with given limits (stated limits should be inclusive, that is if limits 10 and 20 are given number both 10 and 20 may be returned as the random number). CourseNana.COM

  • Fill a given array of integers with a given size with value 0 - that is fill the array to its capacity (all elements are now “used”). CourseNana.COM

  • Fill a given array of integers with a given size with a user-defined value n - that is fill the array to its capacity. CourseNana.COM

  • Fill a given array of integers with a given size with random values within a given range - that is fill the array to its capacity. CourseNana.COM

  • Clear an array of integers with a given size - that is, mark all array elements as being “unused”. CourseNana.COM

  • “Defragment” an array of integers with a given size: move all “used” ele- ments to the beginning of the arra and all “free” elements to the end of the array. CourseNana.COM

  • Sort an array of integers with a given size in ascending order (you need to find a method yourself - any method that works is acceptable, it does not need to be particularly efficient). CourseNana.COM

  • Randomize an array of integers with a given size - that is rearrange the elements of an arry in a random fashion. CourseNana.COM

Page 2 of 7 CourseNana.COM

CE4703/ED5071 Assignment #1 CourseNana.COM

  • Print only “used” elements of an array of integers with a given size in form {n1, n2, n3,. . . , n}. An empty array (array with only “unused” elements) is printed as {}. CourseNana.COM

  • Print (all) elements of an array of integers with a given size in form {n1, n2, n3,. . . , n}. This function prints both, used and unused elements. CourseNana.COM

  • Return the minimum element of an array of integers with a given size. CourseNana.COM

  • Return the maximum element of an array of integers with a given size. CourseNana.COM

  • Compute and return the average value (as double) of and array of integers with a given size. CourseNana.COM

  • Obtain and return the median value of and array of integers with given size. CourseNana.COM

  • Compute and return the variance (as double) of and array of integers with CourseNana.COM

    a given size. Variance v of {n1,n2,n3,...,nN} is given as: CourseNana.COM

    N
    P(ni avg)2 CourseNana.COM

  • Compute and return the standard deviation (as double) of and array of integers with a given size. Standard deviation is calculated as follows: CourseNana.COM

    vu N
    u P (ni avg)2 CourseNana.COM

  • Return the number of used elements in an array of integers of a given size (this is not neccessarily the same as the size). CourseNana.COM

  • Return the number of unique used elements in an array of integers of a given size. For example, if your array holds elements {3, 1, 2, 3, 4, 3, 2, 2, 3, 4}, it holds 10 elements in total, but it holds only 4 unique elements (elements 1,2,3,4). CourseNana.COM

  • Print (to the screen) a frequency distribution of the unique elements of an array of integers of a given size. That is, print to the screen a summary how often each (unique) element occurs in the array. For example, if your array holds elements {3, 1, 2, 3, 4, 3, 2, 2, 3, 4} then the following ouput should be obtained: CourseNana.COM

,
where avg is the average value and N are the number of elements in the CourseNana.COM

array). CourseNana.COM

t i=1
N CourseNana.COM

,
where avg is the average value and N are the number of elements in the CourseNana.COM

array). CourseNana.COM

Page 3 of 7 CourseNana.COM

CE4703/ED5071 Assignment #1 CourseNana.COM

N Count 34 11 23 42 CourseNana.COM

Note: The output should be something like this. Minor differences in for- matting (number of blanks etc.) will not impact on the marking. The order in which the elements occur in the two column display is not important. CourseNana.COM

A test main() function - see comments in Section 3. CourseNana.COM

Module Implementation CourseNana.COM

Implement your application one module at a time (all modules should be placed within the same VS project). Each module consists of two files: a header file (with a .h extension - make sure it contains an inlude guard) that contains all declarations and a source file (with a .c extension) that contains the implementa- tion for all functions of a given module. As these modules are quite small, there is no need to organize them in folders/directories. Also, please make sure to store the main() function in a separate C souce file. CourseNana.COM

Also, your program must use the following: CourseNana.COM

  • Files need to #include your own header files as required. CourseNana.COM

  • At least one simple Pre-Processor macro must be defined and used. CourseNana.COM

  • At least one Pre-Processor macro that takes in two parameters must be defined and used. CourseNana.COM

  • Conditional Inclusion in at least one location. CourseNana.COM

  • Define the following symbolic constants: CourseNana.COM

Symbolic Constants Name CourseNana.COM

MYSIZE1 MYSIZE2 MIN1 MAX1 MIN2 MAX2 CourseNana.COM

Value CourseNana.COM

  10
  50
  0
  10
 100
 120

Page 4 of 7 CourseNana.COM

CE4703/ED5071 Assignment #1 CourseNana.COM

3.1 The main() Function
The main() function performs the following (whenever an array is printed to the CourseNana.COM

screen, make sure to also print the array’s name): CourseNana.COM

  • Create array data1 with MYSIZE1 elements, clear the array and print the array. CourseNana.COM

  • Fill data1 with random values in range MIN1 to MAX1 and print the array. CourseNana.COM

  • Sort data1 and print it to the screen. CourseNana.COM

  • Randomize data1 and print it to the screen. CourseNana.COM

  • Fill data1 with values {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} and print it to screen. Remove values 1, 4, 5, and 9 from array (mark their locations being “un- used”) and print all of the array. Also, print the number of used elements in data1. CourseNana.COM

  • Defragment the array and print again all of the array. CourseNana.COM

  • Obtain and print minimum, maximum, average and median value of data1. CourseNana.COM

  • Obtain and print variance and standard deviation of data1. CourseNana.COM

  • Create array data2 with MYSIZE2 elements, fill it with values {3, 1, 2, 3, 4, 3, 2, 2, 3, 4} and print it to the screen. CourseNana.COM

  • Obtain and print the number of used elements in data2, the number of unique used elements and print the frequency distribution of data2. CourseNana.COM

  • Fill data2 with MYSIZE2 random values in range MIN2 to MAX2 (over- write previous values). CourseNana.COM

  • Obtain and print minimum, maximum, average and median value of data2. CourseNana.COM

  • Obtain and print variance and standard deviation of data2. CourseNana.COM

  • Obtain and print the number of used elements in data2, the number of unique used elements and print the frequency distribution of data2. CourseNana.COM

  • Sort data2 and print it. CourseNana.COM

Page 5 of 7 CourseNana.COM

CE4703/ED5071 Assignment #1 CourseNana.COM

4 Marking CourseNana.COM

This is an individual assignment - each student must develop his/her own solution. Any duplicate solutions will receive 0 marks. CourseNana.COM

The following items will impact on your marks: CourseNana.COM

  • Does your solution perform the required actions correctly? CourseNana.COM

  • Quality of Modular Structure. CourseNana.COM

  • Overall quality of your code (including choice of names for variables and structure of your code). CourseNana.COM

  • Do not use global variables - unless you provide a very good justification why global variables make sense, you will loose marks! CourseNana.COM

  • Quality of your comments (cf. slide “Commenting Guidelines” in Unit 1). Lack of comments will result in very significant loss of marks!!! And yes, you do need “in code” comments in addition to the Doxygen comments CourseNana.COM

  • Quality of your code format - follow K&R Coding Style as discussed in lecture (cf. slides “K & R Coding Style” in Unit 1). CourseNana.COM

  • Presence of warnings will cause loss of marks! Please make sure to use standard C, enable warninga and use separate compilation. CourseNana.COM

  • If your code does not compile you will receive 0 marks! CourseNana.COM

  • Thus, if you are not able to finish any part of the exercise successfully, comment out the sections of code that cause the problem (don’t delete it - I might find some merrit in it and you may gain some marks). CourseNana.COM

Marking Scheme
hline Modular Structure & report
Correcly implemented functions (1
12 marks each) CourseNana.COM

All Pre-Processor features implmented
Correct & complete
main() function (2/bullet-point). CourseNana.COM

Penalties: CourseNana.COM

Poor Modular Structure:
Insufficient comments:
Poor code format:
Bad coding style (e.g. using
goto or global variables) Compile Time Warning: CourseNana.COM

Compile Time Error:
Total: (Note: Marks will be scaled down to 20%.) CourseNana.COM

30 30 CourseNana.COM

10 30 CourseNana.COM

Up to -50% Up to -30% Up to -30% Up to -50% -10% each -100% CourseNana.COM

120 CourseNana.COM

5 Deadline & Submission CourseNana.COM

Deadline for this assignment is 11:00h on Thursday, 09.11.2023. CourseNana.COM

Please submit your solution as a single zip file via the module’s Brightspace page. All solutions must be submitted as MV Studio projects - please put your entire solution into a zip archive (Remove the “.vs” folder in your solution and peform BuildClean before you zip your solution). CourseNana.COM

A complete solution contains: CourseNana.COM

  • All source & header files (suitable formatted & commented) as part of a VS project. CourseNana.COM

  • Generated Doxygen documentation in HTML format (stored in a subfolder in the project’s base folder). CourseNana.COM

  • Report - named after your ID number - in text format, containing: List of modules, list of functions per module, specification for each functions, pseudo-code for each function. CourseNana.COM

    6 Queries CourseNana.COM

    Please post any queries regarding the assignment on the forum “Assignment #1 Q&A” (found in “Discussions” tab on the Brightspace page). This will ensure that the entire class gets the benefit of the answer. CourseNana.COM

Page 7 of 7  CourseNana.COM

Get in Touch with Our Experts

WeChat (微信) WeChat (微信)
Whatsapp WhatsApp
Limerick代写,CE4703代写,Computer Software 3代写,ED5071代写,Computer Engineering Fundamentals代写,C++代写,Python代写,Limerick代编,CE4703代编,Computer Software 3代编,ED5071代编,Computer Engineering Fundamentals代编,C++代编,Python代编,Limerick代考,CE4703代考,Computer Software 3代考,ED5071代考,Computer Engineering Fundamentals代考,C++代考,Python代考,Limerickhelp,CE4703help,Computer Software 3help,ED5071help,Computer Engineering Fundamentalshelp,C++help,Pythonhelp,Limerick作业代写,CE4703作业代写,Computer Software 3作业代写,ED5071作业代写,Computer Engineering Fundamentals作业代写,C++作业代写,Python作业代写,Limerick编程代写,CE4703编程代写,Computer Software 3编程代写,ED5071编程代写,Computer Engineering Fundamentals编程代写,C++编程代写,Python编程代写,Limerickprogramming help,CE4703programming help,Computer Software 3programming help,ED5071programming help,Computer Engineering Fundamentalsprogramming help,C++programming help,Pythonprogramming help,Limerickassignment help,CE4703assignment help,Computer Software 3assignment help,ED5071assignment help,Computer Engineering Fundamentalsassignment help,C++assignment help,Pythonassignment help,Limericksolution,CE4703solution,Computer Software 3solution,ED5071solution,Computer Engineering Fundamentalssolution,C++solution,Pythonsolution,