CS 1803 Pair Homework 4 Greedy Scheduler (Part I) Due: Wednesday, September 29th, before 6 PM Out of 100 points

Similar documents
CS 2316 Individual Homework 4 Greedy Scheduler (Part I) Due: Wednesday, September 18th, before 11:55 PM Out of 100 points

CS 1803 Pair Homework 3 Calculator Pair Fun Due: Wednesday, September 15th, before 6 PM Out of 100 points

CS Homework 4 Employee Ranker. Due: Wednesday, February 8th, before 11:55 PM Out of 100 points. Files to submit: 1. HW4.py.

CS Homework 4 Lifeguard Employee Ranker. Due: Tuesday, June 3rd, before 11:55 PM Out of 100 points. Files to submit: 1. HW4.py.

CS 2316 Individual Homework 5 Joint Probability Out of 100 points

CS 2316 Pair 1: Homework 3 Enigma Fun Due: Wednesday, February 1st, before 11:55 PM Out of 100 points

CS 2316 Homework 9a Login Due: Friday, November 2nd, before 11:55 PM Out of 100 points. Premise

Ascii Art. CS 1301 Individual Homework 7 Ascii Art Due: Monday April 4 th, before 11:55pm Out of 100 points

CS 1803 Individual Homework 2 Conditionals & Loops Due: Wednesday, September 8th, before 6 PM Out of 100 points

CS 1803 Individual Homework 1 Python Practice Due: Wednesday, January 26th, before 6 PM Out of 100 points

CS 1803 Individual Homework 2 Conditionals & Loops Due: Wednesday, February 2 nd, before 6 PM Out of 100 points

CS 2316 Homework 9a GT Room Reservation Login

CS 1803 Pair Homework 10 Newsvendor Inventory Policy Due: Monday, November 29th before 6:00 PM Out of 100 points

CS 1301 Pair Homework 4 Conditionals & Loops Due: Friday, October 1, before 6 PM Out of 100 points

CS 2316 Homework 9a GT Pizza Login Due: Wednesday November 6th Out of 100 points. Premise

CS 2316 Homework 9b GT Room Reservation

CMSC 201 Fall 2016 Homework 6 Functions

CS 1301 Individual Homework 3 Conditionals & Loops Due: Monday February 8 th before 11:55pm Out of 100 points

CS 2316 Homework 9b GT Thrift Shop Due: Wednesday, April 20 th, before 11:55 PM Out of 100 points. Premise

Visit the TA Helpdesk (schedule posted on class website)

CS 1301 Homework Robot Web Writer

This homework has an opportunity for substantial extra credit, which is described at the end of this document.

CS 1301 Pair Homework 2 Conversions Due: Monday January 27th, 2014, before 11:55pm Out of 100 points Files to submit: hw2.py

CS 2316 Individual Homework 1 Python Practice Due: Wednesday, January 20 th, before 11:55 PM Out of 100 points

CS 2316 Individual Homework 1 Python Practice Due: Wednesday, August 28th, before 11:55 PM Out of 100 points

Functional Programming, Classes, and Recursion!

CMSC 201 Spring 2019 Lab 06 Lists

Please make sure that when you submit your assignment, you submit a single HW6.py file that contains your entire assignment.

Individual Homework- Create Your Own Password! Due: September 15 th, 2014 Before 11:55PM Out of 100 points

Lab 1: Silver Dollar Game 1 CSCI 2101B Fall 2018

CS 241 Data Organization. August 21, 2018

CIS192: Python Programming

Program Assignment 2

CS 4800: Algorithms & Data. Lecture 1 January 10, 2017

// class variable that gives the path where my text files are public static final String path = "C:\\java\\sampledir\\PS10"

Programming Standards: You must conform to good programming/documentation standards. Some specifics:

3. When you process a largest recent earthquake query, you should print out:

FAU. How do I. Post course content? Folders

This homework is due by 11:59:59 PM on Thursday, October 12, 2017.

Welcome to Blackboard

CS1 Lecture 3 Jan. 22, 2018

CMSC 201 Spring 2017 Lab 05 Lists

Lecture Programming in C++ PART 1. By Assistant Professor Dr. Ali Kattan

MATH 1MP3 Homework #4 Due: 11:59pm, Wednesday, March 6.

Math 180 Written Homework Solutions Assignment #1 Due Thursday, September 4th at the beginning of your discussion class.

by the evening of Tuesday, Feb 6

CS 374 Fall 2014 Homework 2 Due Tuesday, September 16, 2014 at noon

CIT 590 Homework 5 HTML Resumes

Homework 5. Due Friday, March 1 at 5:00 PM

CSCI 4210 Operating Systems CSCI 6140 Computer Operating Systems Project 1 (document version 1.3) Process Simulation Framework

CPSC 217 Assignment 4

CS451 - Assignment 3 Perceptron Learning Algorithm

CS 1510: Intro to Computing - Fall 2017 Assignment 8: Tracking the Greats of the NBA

SAMS Programming A/B. Lecture #1 Introductions July 3, Mark Stehlik

CS 241 Data Organization using C

CMSC 201 Spring 2018 Project 2 Battleship

Project 1. due date Sunday July 8, 2018, 12:00 noon

The e-marks System: Instructions for Faculty of Arts and Science Users

CMSC 201 Spring 2017 Homework 4 Lists (and Loops and Strings)

CS 211 Programming Practicum Fall 2018

CS 170 Algorithms Fall 2014 David Wagner HW12. Due Dec. 5, 6:00pm

Claremont McKenna College Computer Science

EECE.2160: ECE Application Programming

CpSc 1111 Lab 4 Part a Flow Control, Branching, and Formatting

CS 051 Homework Laboratory #2

CS 210 Fundamentals of Programming I Spring 2015 Programming Assignment 4

Assignment 3: Distance COP3330 Fall 2017

CS 202, Fall 2017 Homework #4 Balanced Search Trees and Hashing Due Date: December 18, 2017

CS1 Lecture 3 Jan. 18, 2019

CMSC 201 Spring 2017 Project 1 Number Classifier

a b c d a b c d e 5 e 7

COMP 412, Fall 2018 Lab 1: A Front End for ILOC

61A LECTURE 1 FUNCTIONS, VALUES. Steven Tang and Eric Tzeng June 24, 2013

Welcome to CS61A! Last modified: Thu Jan 23 03:58: CS61A: Lecture #1 1

CS : Programming for Non-majors, Fall 2018 Programming Project #2: Census Due by 10:20am Wednesday September

CSE 504: Compiler Design

Application System Guide

CMSC 201 Spring 2016 Homework 7 Strings and File I/O

Assignment 3 ITCS-6010/8010: Cloud Computing for Data Analysis

6.00 Introduction to Computer Science and Programming Fall 2008

Get Started with Blackboard For Instructors

COP4530 Data Structures, Algorithms and Generic Programming Recitation 3 Date: January 20 & 22, 2009

Basic Data Types and Operators CS 8: Introduction to Computer Science, Winter 2019 Lecture #2


The print queue was too long. The print queue is always too long shortly before assignments are due. Print your documentation

Lab 4: Bash Scripting

Department of Instructional Technology & Media Services Blackboard Grade Book

COLLECTIONS & ITERATORS cs2420 Introduction to Algorithms and Data Structures Spring 2015

First cut, scope. Defining scope. Find the namespace. Passing argument to parameter. A function s namespace 6/13/2017. chapter 8.

Programming Assignment 3

CS2223: Algorithms D-Term, Assignment 5

Homework 2 Solutions

Homework 1. Notes. What To Turn In. Unix Accounts. Reading. Handout 3 CSCI 334: Spring, 2017

San Jose State University College of Science Department of Computer Science CS151, Object-Oriented Design, Sections 1, 2, and 3, Spring 2018

S206E Lecture 19, 5/24/2016, Python an overview

CIS192 Python Programming. Robert Rand. August 27, 2015

CS61B, Fall 2014 Project #1 (revision 4) P. N. Hilfinger

Project 5 Handling Bit Arrays and Pointers in C

: Intro Programming for Scientists and Engineers Assignment 3: Molecular Biology

Gradebook Export/Import Instructions

Transcription:

CS 1803 Pair Homework 4 Greedy Scheduler (Part I) Due: Wednesday, September 29th, before 6 PM Out of 100 points Files to submit: 1. HW4.py This is a PAIR PROGRAMMING Assignment: Work with your partner! For pair programming assignments, you and your partner should turn in identical assignments. List both partners names at the top. Your submission must not be substantially similar to another pairs' submission. Collaboration at a reasonable level will not result in substantially similar code. Students may only collaborate with fellow students currently taking CS 1803, the TA's and the lecturer. Collaboration means talking through problems, assisting with debugging, explaining a concept, etc. You should not exchange code or write code for others. For Help: - TA Helpdesk Schedule posted on class website. - Email TA's or use T-Square Forums Notes: Don t forget to include the required comments and collaboration statement (as outlined on the course syllabus). Do not wait until the last minute to do this assignment in case you run into problems. Read the entire specifications document before starting this assignment. Premise In this assignment, you will be tasked with reading in data about meeting times for various courses. Once you read in this data, you will be required to insert the data into the given data structure which consists of a Dictionary, lists, and tuples. After inserting all of the data into the data structure, you will be required to print out the structure in a readable format. Details about the file you will be reading, the data structure you will be creating, and the output format will be covered later in this specification. In this assignment, you will be required to write the following four functions: 1. insertintodatastruct() 2. parseline() 3. readcsvfile() 4. printdatastruct()

File Format Information For this assignment, you will be given a comma separated value (CSV) file. This file will contain the following information: The name of a course, followed by pairs of start times and end times. All of this data is separated by commas, as is standard in a CSV file. Take the following example line: CS 1803,1505,1555,1405,1455 CS 1803 is the course name. After the course name, there will be some number of start time and end time pairings, listed in 24 hour format with no punctuation (1:30 PM would be listed as 1330 in the file). In the example above, there are two times this course meets: 1505 1555 and 1405 1455. You do not need to convert the times into any other format. You may safely assume that every start time will have an end time and that all times are properly formatted (i.e. there are no bad times such as 1660 in the file, or times which contain anything other than digits). You should, however, ignore lines which contain only whitespace characters (The strip() function may be useful). Data Structure Information The primary data structure for this assignment will be a dictionary. Remember that dictionaries contain a key which is how you look up information in the dictionary, and each key has an associated value with it. In this particular dictionary, the key will be the name of the course and the value will be a list which contains the course time pairs. The course time pairs are stored as a tuple where the first element in the tuple is the start time (represented as an integer) and the second element in the tuple is the end time (also represented as an integer). An example of this structure with actual data looks something like this: CS 1803 [(1505,1555),(1405,1455)] CS 4400 [(1305,1335),(1405,1435),(1505, 1535)] Note that the list can have any number of course start/stop times in it, but each key will have at least one set in its value list.

Function Name: insertintodatastruct string A string which contains the name of the course. string A string which contains the start time of the course. string A string which contains the end time of the course. Write a function that will accept three parameters: the first parameter is a string which is the name of the course; this will serve as the key when you actually add the tuple you will create to the list of times the course meets. The second parameter is a string representing the start time of the class, and the third parameter is a string representing the end time of the class. Using the two times you are given, you must first construct a tuple containing the start and end times of the course, in that order (see the Data Structure Information above). Then you must add the tuple you just created to the list of tuples which represents the times when the given course meets. You will need to create this list in the event that you are not adding a time pairing to a course which is already in the dictionary. Otherwise, you should add the tuple to the existing list. Function Name: parseline string A string which contains the contents of one line from the file Write a function that will accept one parameter, a string which contains the contents of one line from the file you are reading in the function readcsvfile(). The parseline() function will then separate out the parts of the file, then make the appropriate calls to insertintodatastruct() to put the information it has extracted from the line of the file into the data structure. You must call insertintodatastruct() to put the data into the structure; do not insert the parsed data directly into the data structure inside of parseline(). Function Name: readcsvfile string A string which contains the name of the file to read in Write a function that will accept one parameter, a string which contains the name of the CSV file you wish to parse (for example, coursetimes.csv ). Your function will then read in this file and call parseline() on each line to parse the information contained within that line. You must call parseline() inside of readcsvfile() to parse each line of

the file; the only thing that this function should do is read in the contents of the file and pass each line to parseline(). In the event that the user provides an invalid file name, you should print a message such as Invalid file name. and force the user to enter a valid file name. Remember to close the file when you re done reading in the information. Function Name: printdatastruct This function will display the contents of your data structure in a format which is more easily readable than Python s built-in dictionary printing format. The format should look like the following: Course Name: Course Name: The order in which the courses and their times are printed is unimportant so long as each start time and end time pair is printed under the proper course. You do not need to convert the times to 12 hour format or add colons between the hours and minutes; simply print out the integer values as they are stored in your data structure.

Testing Your Code (Test Cases) insertintodatastruct: Assuming at the beginning of this test the dictionary is empty and the dictionary is named courses. insertintodatastruct( CS 1803, 1505, 1555 ) insertintodatastruct( CS 1803, 1405, 1455 ) insertintodatastruct( CS 1803, 1305, 1355 ) insertintodatastruct( CS 4400, 1405, 1455 ) insertintodatastruct( CS 4400, 1605, 1655 ) {'CS 1803': [(1505, 1555), (1405, 1455), (1305, 1355)], 'CS 4400': [(1405, 1455), (1605, 1655)]} Note that your results may be in a slightly different order as there is no defined order for dictionaries. Just ensure that all of the data has been successfully placed into the dictionary. parseline: Note that the functionality of the parseline() function depends heavily on insertintodatastruct() working correctly; it is advisable that you have insertintodatastruct() coded before testing parseline(). Assuming at the beginning of this test the dictionary is empty and the dictionary is named courses. parseline( CS 1803,1505,1555,1405,1455,1305,1355 ) {'CS 1803': [(1505, 1555), (1405, 1455), (1305, 1355)]} parseline( CS 4400,1405,1455,1605,1655 ) {'CS 1803': [(1505, 1555), (1405, 1455), (1305, 1355)], 'CS 4400': [(1405, 1455), (1605, 1655)]}

readcsvfile: Note that the functionality of the readcsvfile() function depends heavily on parseline() working correctly; it is advisable that you have parseline() coded before testing readcsvfile(). Assuming at the beginning of this test the dictionary is empty and the dictionary is named courses. This test uses the included coursetimes.csv file. readcsvfile( coursetimes.csv ) {'CS 1803': [(1505, 1555), (1405, 1455), (1305, 1355)], 'CS 4400': [(1405, 1455), (1605, 1655)], 'MATH 2402': [(1405, 1525)]} printdatastruct: Assuming at the beginning of this test the dictionary is empty. insertintodatastruct( CS 1803, 1505, 1555 ) insertintodatastruct( CS 1803, 1405, 1455 ) insertintodatastruct( CS 1803, 1305, 1355 ) insertintodatastruct( CS 4400, 1405, 1455 ) insertintodatastruct( CS 4400, 1605, 1655 ) printdatastruct() CS 1803: 1505 1555 1405 1455 1305 1355 CS 4400: 1405 1455 1605 1655 It is strongly recommended you also write your own additional test cases which include blank (whitespace) lines in the CSV file, as well as a longer set of inputs.

Grading: You will earn points as follows for each function that works correctly according to the specifications. insertintodatastruct() 30 Converts start and end times to integers 5 Properly handles input when course already exists 13 Properly handles input when course does not exist 12 parseline() 20 Properly handles the course name 5 Properly handles all time pairs in the line 10 Properly calls insertintodatastruct() 5 readcsvfile() 30 Properly handles invalid file name 6 Properly handles multiline files 6 Properly ignores whitespace lines 6 Properly passes lines in file to parseline() 6 Closes the file before exiting the function 6 printdatastruct() 20 Output properly formatted 10 Output contains all entries in dictionary 15