icon

UseTopicwritingscode to get 5% OFF on your first order!

C Coding Project

MUST BE IN C

Write a program that manages a small list of students in a university:
Student struct should contains the flowing data members (/subdata elements):
fname, lname, birthYear (ex. 1990), gpa (ex. 3.68).
Max number of characters for fname and lname is 20.
User should be prompted with a menu of options to choose from (use switch statement):
0: Exit, 1: Load data from the file, 2:  Print all students’ information, 3: Generate report based on GPA , 4: Add student 5: Update the file.
The above line should be printed out for the user as the menu with each option in one line. The menu should be presented to the user each time that the user wants to choose a new option.
Option 1: “students.csv” with students’ information has been provided, download and place the file in your project/program directory (folder). This option needs to read the information from the file and populate an array of structures (passed to it from the main).
Option 2: this function should be called after the load data, to print all the students’ information out (each student in one line) to test the successful load of data.
Option 3: this option will first ask for a gpa (prompt), and then writes out the students’ information (only fname, lname and gpa)  with a gpa higher than the given threshold to a file named “report.csv”
Option 4: will add a student to the array by asking the information from the user. Don’t forget to prompt for the inputs and Check for the right values to be entered for gpa and age (less than 100 greater than 18). Each time user selects this option, he/she has the ability to only add one student’s information. Make sure if the user enters characters (a b c…) instead of a number for age and gpa your program will detect the wrong input and won’t crash.
Option 5: Since we may have new students, this function should update the file  “students.csv” with new student(s)’ information. to reduce the complexity for you, you can consider overwriting the file with all the information you have in array. Just write the whole updated array of struct to the same file. Check if it works right by opening the file after write is finished! ( check to see if new students are added and you can run the program again to read the uploaded file)
=====================================================================================

Notes:
For functions requiring to work with a file, open the file in the main before the call, send the pointer of the file to the function, and finally don’t forget to close the file after you returned back (this will help you when you want to update the file)
Since we may add students to the array of struct, you can consider max size of 100 students, BUT still use dynamic memory allocation for the array of struct! (you don’t need to count number of the lines for creating exactly the same sized array)
You should upload 5 files: main.c, studentInfo.h and studentInfo.c, ” students.csv” and “report.csv” to Blackboard.com
Add a couple of students with option 4 and then update the file with option 5.
Please test your code to be able to open the new updated “students.csv” file.
The “report.csv” should be generated for gpa of 3.0
The functions should be named as below:
loadData(), printAll(), genReport(), addStudent(), updateFile()
consider proper parameters, arguments, and return types/values for each function
Include only required header files!
Plagiarism will be done by blackboard.com. Please do not copy the code from anyone, both students will get a grade of zero and will be reported.
=====================================================================================

Rubrics:
Following the style (indentations, etc.) 5 points
Functions with proper declaration, prototype, call in right file/place and following the provided guideline (name, right return and arguments)
loadData() 10 points
printAll() 5 points
genReport() 10 points
addStudent() 10 points
updateFile() 10 points

You can leave a response, or trackback from your own site.

Leave a Reply

Powered by WordPress | Designed by: Premium WordPress Themes | Thanks to Themes Gallery, Bromoney and Wordpress Themes