CSCE 113 —Group Project 1 (200 pts) Due November 9, 2014 at 11:59 pm Please see the course web page for the group assignment Please submit a hard copy of your program and report, and electronic version of your source code. Please return the report to your TA in the lab. Objective: In this group project, you must write a C++ program which focuses on defining new types in C++ and showing relations between classes (similar to the slide 24, chap. 6). Compile the program and test its correctness using different input data (valid and invalid data). General Guidelines 1. This project can be done in groups of at most three students, see the course page for the group assignments. Please use the cover sheet at the previous page for your hard copy report. 2. The programs should be coded in C++ and the code has to be well documented. Please provide your name(s), completion date and program descriptions in the program headers. 3. The program templates are packed in the file 113-12c-P1-code.tarwhich can be downloaded from the course website. You may untar the file using the following command on Unix. tar xfv 113-12c-P1-code.tar 4. Make sure your code can be compiled using g++/c++ before submission because your program will be tested on a CS UNIX machine. Use the following command to compile g++ *.cpp -o proj1 or use Makefile provided with program templates by typing the following line command on a Unix console. make 5. Instructions about how to “tar” your file. – Place the source files and testing files in a folder on the CS Unix machine, which is the H drive on lab computers – Go into that folder and use the following command to pack your files into the file pa1.tar tar cvf pa1.tar * – The contents of the tar file pa1.tar can be viewed by: tar tf pa1.tar – TA will untar your files using the command tar xvf pa1.tar 6. Use eCampus to submit your tar file pa1.tar 7. The hard copy report should include a copy of your source code. 8. Provide all tests done to verify correctness of your program in the report. Give an explanation why you chose such tests. 9. The assignment will be graded focusing on: program design, correctness and provided report. 10. Your program will be tested on TA’s input files. Problem Description 1. Write a C++ program that performs the following tasks: (a) (b) (c) (d) (e) (f) 2. Read in any data file in the format specified below (provide a prompt for the file name). Calculate final score and final grade for one student using the data from the input file as specified below. Display final score, grade and other associated data for one student. Provide a menu for all options of your program. Display the student(s) with the highest score in a group of students. List all students in alphabetical order with respect to their last name. Implement bubble sort (or any sorting algorithm) from scratch. In C++, define the following classes: (a) class Menu containing the functions for all options of your program: i. display the assignment’s information (your first and last name, and the string "Project 1") ii. read a student from a file (ask for a file name) iii. display the options 1.(a) and 1.(c) . iv. display the option 1.(e) v. display the option 1.(f) vi. exit the program (b) class Student with the following members: i. private data: String firstName, String lastName, String ID ii. functions: • void display() — displays the student information, that is, his or her student ID, first name and last name. (c) class Courses with the following members: i. private data: • 10 quizzes graded on the scale from 0 to 100 (weighted 5%) • 6 homework graded on the scale from 0 to 100 (weighted 50%) • 4 tests graded on the scale from 0 to 100 (weighted 45%) • double final_score, • char letter_grade. ii. functions: • void calc_final_score()—calculates the final grade based on the weights provided • void calc_letter_grade()— calculates the appropriate letter grade (A, B, C, D, F). • void display()—displays the final score (rounded to the nearest integer) and the letter grade. (d) class StudentCourseswith the following members: i. private data: • Student student, • Courses courses ii. functions: • double get_final_score() — returns the final grade from the class Courses. • void display() — displays student’s info (from the class Students), the final score and a letter grade (from the class Courses). (e) class GroupOfStudentswith the following members: i. private data: • vector<StudentCourses> st vec ii. functions: • void display()— displays all the students (unsorted), • • void display_sorted()— displays all the students sorted in alphabetical order with respect to their last name, void display_highest() — searches the students for the one(s) with the highest score and displays him/her/them. Remember to use constructors to initialize objects of each class. 3. Format of an input file: firstName1 lastName1 SID1 quiz1 quiz2 quiz3 quiz4 quiz5 quiz6 quiz7 quiz8 quiz9 quiz10 hw1 hw2 hw3 hw4 hw5 hw6 test1 test2 test3 test4 firstName2 lastName2 SID2 quiz1 quiz2 quiz3 quiz4 quiz5 quiz6 quiz7 quiz8 quiz9 quiz10 hw1 hw2 hw3 hw4 hw5 hw6 test1 test2 test3 test4 ... 4. Output format for displaying a student: SID firstName lastName finalScore letterGrade 5. Example. Assume that the input file contains the following data: John Smith 234-56-0000 72 81 56 75 91 69 76 85 74 77 81 90 75 86 93 79 78 82 89 79 The output format for this student should be as below 234-56-0000 John Smith 83 B 6. Write an exception that displays amessage "Invalid input data format" in a case when not all information about student’s grades is provided or the grades have wrong type (not a number) or range (the correct range is between 0 and 100). In menu, write an exception that displays a message "Invalid input file name" for a case when the data file is missing or is not available. 7. Test your program for different sets of data considering different input arrangements. 8. In your report, provide information according to handout on the instructor’s web page and TA’s grading sheet. Report 1. The purpose of this project. 2. How to run you program (specify the name of your executable file). 3. Input and output format. (a) Main menu (copy and paste the output generated by your program). (b) Format of data from a file. Specify if you have to put one data item in each line or all data may be on the same line. Give an example. (c) Cases in which your program crashes because of wrong input (for example, a wrong file name, a letter instead of a number, or the program expects more data than what is provided). (d) Cases of wrong input that you catch with Exceptions. 4. Exceptions. List the cases in which your program crashes or when you catch the exception due to execution problems. For example, division by 0. (a) Cases in which the program crashes. (b) Cases in which you catch the exceptions. 5. Algorithm description. Choose an algorithm that you used to solve a challenging problem in your code and describe it. Analyze an algorithm according to an assignment requirements (do not describe the menu). 6. Classes. List all the classes or interfaces you used (including Exceptions classes). Write about I/O, object oriented or generic programming features you used. 7. Tests. Test the logical correctness of your program (do not test the menu). Describe the cases, and copy and paste the output of your program in those cases. (c) Valid cases. (d) Invalid cases.
© Copyright 2018