Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this assignment you will parse and compute statistics from course schedules. Please read the entire handout before starting to code the assignment. Input Format

In this assignment you will parse and compute statistics from course schedules. Please read the entire handout before starting to code the assignment. Input Format You will parse an input le with information for zero or more courses. An example line might look like: 64859 CSCI 4030-01 RANDOMIZED_ALGORITHMS MR 10:00AM 11:50AM DARRIN_239 Each line contains several elds, separated by spaces. You can assume that values have no white spaces, i.e. a course name like RANDOMIZED ALGORITHMS is illegal. There are 8 elds in each line: a CRN (unique ID, e.g. 64859), a department code (e.g. CSCI), a course code (e.g. 4030-01), the course title (e.g. RANDOMIZED ALGORITHMS), the days this course occurs on (e.g. MR), the time the course starts (e.g. 10:00 AM), the time the course ends (e.g. 11:50AM), and a room (e.g. DARRIN 239). Each letter in the days represents one day, with M being Monday, T being Tuesday, W being Wednesday, R being Thursday, and F being Friday. Multiple days can appear on one line in the input, as shown in the example above. Time is always two digits for the hour, a colon, two digits for the minute, and then either AM or PM. There may be multiple lines for one course, so you will want to study the provided input and output carefully before beginning. We strongly recommend that you use the iostream >> operator to parse this le and not use getline or other C-style le I/O commands. File I/O and Command Line Arguments Your program will run with several command-line arguments, the rst being the name of the input le described above and the second being the name of the output le where you will write either nicely formatted tables or an interesting statistic (described below). Example input and output les posted on the course website. Here are examples of four valid command lines to your program that demonstrate the dierent usages. These are described in more detail below. scheduling.exe simple2.txt out_simple2_room.txt room scheduling.exe simple2.txt out_simple2_room.txt room ACADMY_AUD scheduling.exe simple2.txt out_simple2_dept_ECSE.txt dept ECSE scheduling.exe simple2.txt out_simple2_custom.txt custom We have provided you with several schedule datasets, primarily based o of the Fall 2018 registration data from SIS. We have done some processing to make your task simpler. Room-based Output If the third argument is room then you will be outputting statistics about courses in each room. There is an optional fourth argument, if present you should only print information about courses in the room with the name matching the fourth argument. In the above example all the courses are in ACADMY AUD so the output will look the same with or without the fourth argument. If the room cannot be found, your output should look like the examples using empty.txt . Your spacing must match exactly - there are two spaces in between each column and columns must be wide enough to t the data. When outputting more than one room, the tables should be printed alphabetically by room name. Within each table, courses should rst be sorted by day of the week (Monday should come before Tuesday, Tuesday before Wednesday, etc.). Courses on the same day should be sorted by what hour the course starts at, with the earlier courses coming rst. If two or more courses happen in the same time and place, you should sort those courses by course code, i.e. 1100-01 would come before 1100-02. Department-based Output If the third argument is dept then a fourth argument is mandatory. The fourth argument species a department code (keep in mind this can be anything as long as it does not have whitespace). If no courses for the department code are found, the output should look the same as for the empty.txt case. Similar to the room-based output, the columns in the table that you output should be wide enough to t the data and should have two spaces in between each column. Sorting should be done by course code rst, then by the earliest course (using day then starting hour, as described in the room-based output section above). Creative Statistic The last part of the assignment is a chance for you to be creative. Brainstorm a new interesting statistic that can be calculated and presented from this data. (There is no sample output for this, because there is no autograding for this part beyond whether or not you did it. The TA will manually grade the output for quality. Examples include tabulating when each department opens (has its rst class), perhaps comparing across dierent days, or seeing if some rooms only get heavy usage on certain days. Your new statistic should only be printed if the third argument is custom. NOTE: You MUST make a creative statistic to get full credit, even if you are not interested trying for the extra credit. Extra credit will be awarded to particularly interesting statistics that require clever programming. The most important task for this part of the assignment is to write a concise description (< 100 words) of your new statistic. Put this description in your plaintext README.txt le along with any other notes for the grader. Be sure to tell the grader which dataset best demonstrates your new statistic, and include a sample of the output. Feel free to create your own dataset and include it with your submission. Useful Code To control the formatting of your tables, youll want to read up on the various I/O manipulators: std::setw(int), std::setprecision(int), std::fixed, std::left, etc. Youll need to #include to access these tools. And dont forget about the sort function that can be used to order the contents of a vector. If you add -std=c++11 to your compile line, you can use C++11 features. Submitty will use this ag, if you do not want any C++11 features this will not aect you. However, students on Homework 2 often nd std::stoi to be useful, and this requires C++11. We will not formally cover the concept of include guards until Tuesdays lecture. If you are writing more than one class, you may run into strange compiler errors when you compile everything. This may be due to a problem with including your class les, which can be solved as follows: for a header le called myclass.h add these two lines at the very top of the header le: #ifndef __MYCLASS_H #define __MYCLASS_H and at the very bottom of your .h le, add this line: #endif If you want to make a vector of vectors of a type (lets use int in this example) called vectorname, you can do so by writing std::vector > vectorname and then indexing as usual. vectorname[0] will return a vector in this example. The most important detail is to remember to put a space 2 between the two closing angle brackets. Some compilers will interpret >> as the input operator, even though its obvious to a human reader that this was not the intent. Program Requirements & Submission Details Your program should involve the denition of at least one class that has its own .h and .cpp les, named appropriately. We have provided a series of series of datasets to aid in your program development and debugging. The majority of points for this homework assignment will be awarded for programs that work correctly for the simple examples. Do all of your work in a folder named hw2 inside of your Data Structures homeworks directory. Use good coding style when you design and implement your program. Be sure to make up new test cases and dont forget to comment your code! Please use the provided template README.txt le for any notes you want the grader to read. You must do this assignment on your own, as described in the Collaboration Policy & Academic Integrity handout. If you did discuss the problem or error messages, etc. with anyone, please list their names in your README.txt le. If by Wednesday 11:59:59PM any version of your HW2 that youve submitted has earned 5 points between Test Cases 3, 4, 5, 6, and 7, you will earn you a 1 day extension for

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

AWS Certified Database Study Guide Specialty DBS-C01 Exam

Authors: Matheus Arrais, Rene Martinez Bravet, Leonardo Ciccone, Angie Nobre Cocharero, Erika Kurauchi, Hugo Rozestraten

1st Edition

1119778956, 978-1119778950

More Books

Students also viewed these Databases questions

Question

4. Who would lead the group?

Answered: 1 week ago

Question

Where those not participating, encouraged to participate?

Answered: 1 week ago