CSE 1320: Intermediate Programming Assignment 3 solution

$29.99

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (8 votes)

1. (20%) Create a program that calculates the minimum, maximum, median, and mean of an array of numbers. (a) The program should read 10 values to compute the statistics on. (b) You must calculate the minimum, maximum, median, and mean using your own code (NO LIBRARIES). (c) You can use float.h for floating point limits. (d) Use proper indentation and formatting in your code. (e) Each statistic must be implemented as a separate function. (f) The functions must take an array as a formal parameter and return a floating point. (g) Output the values as comma separated values in the following order: i. min ii. max iii. median iv. mean (h) Your code should be properly formatted to reflect the scope of each statement. (i) Save your code as stats.c. 2. (20%) Modify the code selection_sort.c such that it sorts from largest to smallest. (a) The sorting algorithm must be in a separate function called sort_large. (b) No external libraries may be used. (c) The function should print the sorted values of the input array. (d) The return value of the function should be an integer indicating how many values were swapped. (e) Your code should be properly formatted to reflect the scope of each statement. (f) Save the code as sort_large.c. 3. (30%) Create a program that allows the user to create a database of users. Each user will have an ID, name, and age. (a) The maximum user count for the database is 10. CSE 1320: Assignment 3 Dillhoff (b) The maximum name is 100 characters in length. The names should be null terminated (strings). (c) The user ID is the index of the array. (d) Use a 2D array to store the names. (e) Use a 1D array to store the ages. (f) Create a function add_user to add a new user to the database. If the user is successfully added, return 0. If the database is full, this function should return 1 an notify the user. (g) Create a function list_users which lists all users in the database. This should only display users that have been added. (h) Create a function get_user which prints the name and age of a single user if the requested ID exists. It should return 0 on a successful fetch and 1 otherwise. (i) Don’t forget to include array sizes in your functions. (j) Your code should be properly formatted to reflect the scope of each statement. (k) Save the code as database.c. 4. (15%) Create a program that counts the number of proper nouns in a string. (a) A proper noun starts with a capital letter. (b) You can assume that any proper noun given will only be one word. (c) The counting process should be implemented in a function named count_pnouns which returns the number of proper nouns found. The input is a character array and its length. (d) The program should print the number of proper nouns found. (e) Your code should be properly formatted to reflect the scope of each statement. (f) Save your code as proper_noun.c. 5. (15%) Create a program that prints the binary value of an integer. (a) Create a function void int_to_b(short, char[]) which converts the input short to binary. The input character array should be updated to the binary value. (b) The largest value you should expect to convert is 255, so your character array should be of size 8. (c) Do not hard code your array size. It should be defined using a preprocessor directive. (d) Your code should be properly formatted to reflect the scope of each statement. (e) Save your code as to_binary.c. Example Run 255 255 = 11111111 Create a zip file using the name template _.zip which includes the all required code and answer files. Submit the zip file through Canvas. 2