UMBC CS 201, Fall 05
UMBC CMSC 201 Fall '05
CSEE | 201 | 201 F'05 | lectures | news | help

Programming Project Three

Student Records
V 1.1

Out: Sunday 10/30/05
Due: Before Midnight, Sunday 11/13/05

Sun Nov 13 23:59:59 EST 2005 is on time, but one second later the date command will show
Mon Nov 14 00:00:00 EST 2005, which is midnight and your project will be worth 0 points at that time and later.

The design document for this project, design3.txt, is due: Before Midnight, Monday 11/06/05
A sample design document is available from the main Projects page.

Engineering Change Notices

The Objective

The objective of this assignment is to give you practice with arrays of structs, working with characters as input, file-handling, dynamic memory allocation, working with strings, passing by reference, command-line arguments, and, of course, design and separate compilation.

The Background

You have been hired by the CSEE department as the CMSC 201 gradeskeeper. One of your responsibilities is to generate reports. There are basically two different kinds of reports. One type, called stats, gives the breakdown of the number of students by major, by sex, by class (freshman, sophomore, junior, senior) and by section. (I will give an example stats report.)

The other type of report is a grade report. Grade reports can be created for an individual student, all the students of a specific section, or all students in the class. You are to to write a program that prints out these reports (TO AN OUTPUT FILE ONLY - NOT TO A PRINTER ), using the data found in the file called p3students.dat.

The Task

In order to use your program, the person generating the reports should enter the name of the executable and the name of the data file to be used as input on the command line. The input file is called p3students.dat, in this case.

At this point the user should be presented with a greeting and then a main menu that allows him/her to choose the type of report to generate or to quit.

Your greeting goes here Generate : S - Statistical report G - Grade report Q - Quit Enter your choice : After choosing any of these options, the appropriate action should take place and then this menu should be presented to the user again. The user must choose Q from this menu to end the program. Similarly, the user should always be returned to the grades menu until s/he chooses 'R' to return to the main menu.

The records of the students are kept in ascending sorted order by login name and has the information stored separated by spaces for each record in the following order:

login(max of 8 chars) lastName(max of 15 chars) firstName(max of 15 chars) sex(char) major(max of 4 chars) section(max of 5 chars) class(max of 2 chars) proj1(int) proj2(int) proj3(int) proj4(int) proj5(int) lab1(int) lab2(int) lab3(int) lab4(int) lab5(int) lab6(int) lab7(int) lab8(int) lab9(int) lab10(int) lab11(int) lab12(int) midterm(int) finalExam(int)

The file begins with a single integer which is the number of student records in the file. Here's an example of an input file's format:

2 dblock Block Dawn F CMSC 0101 SO 84 91 94 82 99 3 3 2 3 3 3 3 2 3 3 3 3 95 92 sbogar1 Evans Sue F CMSC 0201H SR 85 92 95 83 100 3 3 2 3 3 3 3 2 3 3 3 3 91 93

Design Limitations and Details

A Short Sample Run

linux2[72] % ls proj3.c students.c students.h typescript util.c util.h linux2[73] % gcc -c -Wall -ansi proj3.c linux2[74] % gcc -c -Wall -ansi students.c linux2[75] % gcc -c -Wall -ansi util.c linux2[76] % gcc -Wall -ansi proj3.o students.o util.o linux2[77] % a.out p3students.dat Your greeting goes here Generate : S - Statistical report G - Grade report Q - Quit Enter your choice : T T is not a valid choice Enter your choice : s Generate: S - Statistical Report G - Grade Report Q - Quit Enter your choice : q

Sample Statistical Report

Statistics Report for CMSC 201 Number Percentage students : 25 Sex: male : 19 76.0 % female : 6 24.0 % Major: CMSC : 13 52.0 % CMPE : 5 20.0 % other : 7 28.0 % Class: freshmen : 8 32.0 % sophomores : 11 44.0 % juniors : 4 16.0 % seniors : 2 8.0 % Section: 0101 : 6 24.0 % 0102 : 6 24.0 % 0103 : 4 16.0 % 0104 : 5 20.0 % 0201H : 4 16.0 %

Copying the file

The file you need to use for this project is p3students.dat You may get a copy of this file from my account. The file is in the /afs/ directory.

The executable and the data file need to be in the same directory when you run the program. The command to copy the file is:

cp /afs/ .

Note that there are three parts of the command separated by spaces. The last part is a period (with a space before it), which says copy the file to current directory.

Submitting the Program

To submit the files you should use the command:

submit cs201 Proj3 proj3.c students.c students.h (followed by any other .c and .h files your project needs to be compiled)

Do NOT submit p3students.dat nor any of your output files (stats.txt, or any other *.txt file).

You can check your submission by using the command:

submitls cs201 Proj3

CSEE | 201 | 201 F'05 | lectures | news | help

Sunday, 06-Nov-2005 19:29:37 EST