Docsity

Programming Assignment 3 - Computer Science I | CSCI 1100, Assignments of Computer Science

Toggle sidebar
bg1
CSCI-1100 Computer Science I
Rensselaer Polytechnic Institute
Fall, 2009
Programming Assignment 3
A university needs to keep know the grade point average of each student and class. You are to
write a program that reads in a list of class grades. The table below shows some class and student
data.
Name
Class
Grade
Martin Jones
Database Fundamentals
A
Susan Smith
CS 1
C
Arthur White
CS 1
B
Martin Jones
CS 1
C
Michael Brown
Database Fundamentals
C
Jane Doe
Networking
B
There is a test file on the LMS site. The test file has a CSV (Comma Separated Value) format.
The first line of the file contains header information that must be ignored in the processing (to
see the format open it with wordpad or notepad).
You are to process the data as follows
1. You are to create a struct for the data and you are to read in all of the items in the file into
a vector of these structs. Print out the number of data records found (not including the
title line).
2. You are to create a class for students. Each object in this class is to contain the name of a
student, his or her (computed) GPA and a vector of the struct records for his or her
classes. Print out the number of students found and the total number of credit hours taken
by all of the students (all courses are 4 credits).
3. You are to create a class for the classes. Print out the number of classes found and the
total number of students in all of the classes (if someone is in two classes then he or she
counts twice), and the average GPA for all of the students in each class.
4. To aid debugging you are to set two #define values at the top of your program. If
“#define SHOW_STUDENT” is a given a value of 1 then the program must list all the
values found or computed for each student (see below). If “#define SHOW_CLASS”
is given a value of 1 the program must list all the values found or computed for each class
(see below).
pf2

Partial preview of the text

Download Programming Assignment 3 - Computer Science I | CSCI 1100 and more Assignments Computer Science in PDF only on Docsity!

CSCI-1100 Computer Science I

Rensselaer Polytechnic Institute

Fall, 2009 Programming Assignment 3

A university needs to keep know the grade point average of each student and class. You are to write a program that reads in a list of class grades. The table below shows some class and student data.

Name Class Grade Martin Jones Database Fundamentals A Susan Smith CS 1 C Arthur White CS 1 B Martin Jones CS 1 C Michael Brown Database Fundamentals C Jane Doe Networking B

There is a test file on the LMS site. The test file has a CSV (Comma Separated Value) format. The first line of the file contains header information that must be ignored in the processing (to see the format open it with wordpad or notepad).

You are to process the data as follows

  1. You are to create a struct for the data and you are to read in all of the items in the file into a vector of these structs. Print out the number of data records found (not including the title line).
  2. You are to create a class for students. Each object in this class is to contain the name of a student, his or her (computed) GPA and a vector of the struct records for his or her classes. Print out the number of students found and the total number of credit hours taken by all of the students (all courses are 4 credits).
  3. You are to create a class for the classes. Print out the number of classes found and the total number of students in all of the classes (if someone is in two classes then he or she counts twice), and the average GPA for all of the students in each class.
  4. To aid debugging you are to set two #define values at the top of your program. If “#define SHOW_STUDENT” is a given a value of 1 then the program must list all the values found or computed for each student (see below). If “#define SHOW_CLASS” is given a value of 1 the program must list all the values found or computed for each class (see below).

For example, if #define SHOW_STUDENT is 1 then the following will be listed for Martin Jones and all the other students:

Martin Jones GPA=3.0 Credit_Hours= Database Fundamentals A CS 1 A

And if #define SHOW_CLASS is 1 then the following values will be shown for CS 1 and all the other classes:

CS 1 3 students Average_of_GPA’s=2. Susan Smith Arthur White Martin Jones

Because the GPA for Susan is 2.0, Arthur 3.0 and Martin 3.0.

Grading: Compiles (and is a sincere attempt) 20% Defines classes and vector correctly as specified 20% Reads in the initial data correctly and prints the correct number of records 10% Creates all the student objects and prints the correct number of credit hours. 10% Creates all the class objects and prints the correct number of students and the correct GPA 10% Displays the correct results for #define SHOW_STUDENT 10% Displays the correct results for #define SHOW_CLASS 10% Proper commenting, easy to read output and good program structure 10%