School of Informatics, University of Edinburgh

Size: px
Start display at page:

Download "School of Informatics, University of Edinburgh"

Transcription

1 CS1Ah Practical 4 Motorway Madness This is an individual practical exercise which requires you to submit some files electronically. A system which measures software similarity will be used to compare all of the submissions in order to detect unreasonable levels of collaboration. Your attention is drawn to the guidelines on plagiarism presented in Appendix A of the Computer Science 1 course guide. This practical has been issued on Thursday 5th December The deadline for your solutions is Wednesday 15th January 2003 at 5pm. Your solutions must be submitted electronically from your DICE account with the handin command (which is a short-hand version of the submit command). No alternative methods of submission will be accepted. Specifically, submissions via will not be accepted and submissions on floppy disk will not be accepted. No late submissions will be accepted. To submit your files, execute the handin command exactly as it is shown in this document. In particular, make sure that you use the correct practical identifiers, filenames and extensions. Remember that all names are case-sensitive. Failure to execute the proper submission command cannot be investigated after the practical deadline. Execute the handin command from a shell window (not the KDE command Run Command window), so you can see any error messages which result. If in doubt, consult a laboratory demonstrator for assistance. You can repeat the handin command to resubmit improved versions of your work; later submissions will override earlier ones. But do not resubmit after the deadline: your work would be treated as a late submission. The four practical exercises in Computer Science 1Ah are equally weighted and together they constitute 25% of the final mark for the course. For each practical, a mark out of 25 is recorded. For this practical, parts A, B and D carry six marks, while part C carries seven marks. 1

2 Introduction When driving on motorways in particular, some traffic congestion is fairly comprehensible (tailbacks from roadworks etc.), while other congestion is more mysterious, appearing to have no simple direct cause. This practical involves using a very simple road model in order to simulate traffic flows, and the knock-on effects of some hindrances made to these flows. The practical will give you further practice in programming in Java, and using classes and their methods. In particular, you will make use of an array that is maintained in sorted order, and carry out various operations on its elements. Unlike earlier practicals, you will have less material given as a starting point, and so will gain some experience in programming from scratch. Simulated road General modelling of road systems is complex, often requiring the brute-force power of supercomputers. Here, however, our model is very simple, both in terms of the road system and in terms of the behaviour of drivers. Our road will be a single lane, with cars flowing in one direction; initially, cars can join at the beginning only, and leave at the end only. All distances will be specified in metres, all times in seconds, and hence all speeds in metres per second. We will have a road that is 20,000 metres (i.e. 20km) long, with a default speed limit of 40 metres/second (i.e. 144 km/h). Thus, if a car is able to travel at the maximum speed throughout, it can traverse the road in 500 seconds. Each car is assumed to occupy five metres of road space (so one can infer that there cannot be more than 4000 cars on this road at once). We will simulate the flow of cars along this road over a period of 2000 seconds. The simulation will proceed as a series of 2000 iterations, each simulating what happens during one second. In each second, one car might join the road, one car might leave the road and all other cars on the road will move forward according to current conditions (unless they are stationary in a traffic jam, of course). In terms of cars joining the road, we use a simple model. This says that a new car will start along the road as soon as there is room for it, that is, there is a continuous supply of incoming traffic. Java classes Two Java classes will be central to this exercise. The first one, which is supplied to you, represents a car on the road. This records the car s length (always fixed at five metres), its current distance along the road and its current speed. The current distance is taken as the distance of the rear of the car from the beginning of the road. The other central class, which you have to develop, is one that represents the current state of the road. This includes the road s length and its global speed limit, set when the road is created. The speed limit is modelled by an object which can be queried to return the speed limit in force at any given point on the road. Aside from this, in the first instance, there is just the current collection of cars on the road. For this, the road class uses an array of cars. When there are n cars on the road, elements 0 to n 1 of this array hold the car objects, ordered by increasing distance along the road. 2

3 In later stages of the exercise, two other classes will be added. One represents a speed restriction over some part of the road. The other represents a junction feeding in further traffic at some point on the road. The above classes are all used from a top-level class, which runs the road simulation over a set period of time. In order to visualise the state of the traffic on the road at the end of the simulated period (or indeed, at any intermediate time point in the simulation), we use something which we call a speedgram. This shows car speeds along the length of the road you can see examples of speedgrams in the appendix at the end of this handout. The speedgram gives an easy way of spotting where congestion is occurring, and makes it possible to relate this to deliberate disruptions to the traffic flow. A speedgram class is supplied, allowing you to visualise road states easily. Getting Started Before starting the practical you should make your own copy of the files in the directory /group/teaching/cs1/ah/pracs/motorwaymadness. You can do this efficiently using the command: cp -r /group/teaching/cs1/ah/pracs/motorwaymadness You should only enter the above command once. If you use it a second time you will overwrite your copy of the practical and you will lose the work which you have done. Your home directory will now contain a directory MotorwayMadness containing six Java files. During this practical, you will have to modify two of these (Simulation.java and SpeedLimit.java), as well as creating some new Java files of your own. The other Java files (TestA.java, Car.java, Speedgram.java and SpeedgramWindow.java)are for you to use unchanged. If at all possible, you should avoid submitting code that doesn t compile. Start the practical early and consult a demonstrator if you are having problems figuring things out for yourself. If nevertheless you contemplate submitting code that has compile errors, please comment out the offending code and add a comment explaining what error message you were getting and what you don t understand. By commenting out, you should always be able to get your code back into a state where it compiles. Working on your computer at home If you have access to a computer at home, you may wish to use it when doing some of your practical work. For this you will need a copy of Sun s Java Development Kit Version 1.4 or similar. You can obtain it from Sun s Web site at java.sun.com or it is available on the CD-ROM included with the textbook, Java: How to Program by Deitel and Deitel. You will need to make a copy of the MotorwayMadness directory. If you have Internet access, the most convenient way to do this is to copy files from the web, although this is tedious. A better way is to use the secure copy command scp to remotely copy files from your DICE account. Another way, or if you do not have Internet access, is to take the files home on a floppy disk. On the DICE machines, the command mcopy can be used to copy files onto 3

4 a DOS formatted floppy disk. If you work at home on a Windows machine, you might want to use mcopy -t to copy files onto your floppy. This fixes up Linux line breaks so that Windows editors will recognise them. Please consult a lab demonstrator if you need help with how to retrieve the files needed for the practical exercise. Please do not ask your tutor or the course lecturers about this. Part A: Getting on the road The Car class definition, for objects representing cars, is in the supplied Car.java file. You should have a look at the fields and inspector methods, to make sure you understand what they do. You can ignore the move method until starting Part B. You should now create a file called Road.java containing class definitions for an object representing the road. This should have four fields, all private. The first two are to be called length and numcars and are both of type int. They are used to hold the road s length and the number of cars currently on it, respectively. The third field is to be called cars and is an array of Car objects. It is used to hold, in increasing order of distance travelled, the cars on the road. The fourth field, to be called speedlimit is an object of class SpeedLimit. This is the object which will hold information about the speed limit (and later, speed restrictions) in force on the road. Now, add a constructor method and three inspector methods: public Road (int length, SpeedLimit speedlimit) public int getnumcars () public int getlength () public Car getcar (int i) In addition to storing its two parameterised field values, the constructor should also set numcars to zero, and set cars to be a new array with length/car.length elements. The getcar method should return the i-th element of the car array (for added security, it might check that i is in range, and return null if not). Next, add another method: public void insertcar (int i, Car newcar) This is to insert the newcar object at position i in the array of cars. Prior to insertion, the assumption will be that elements 0 to numcars-1 of the array contain cars (and that these are in order of increasing distance travelled). It should further be assumed that i is in the range 0 to numcars-1. Therefore, it will first be necessary to make room for the new car by moving existing Car objects at positions i onwards up one place in the array. The idea is similar to that used in the method for insertion into an ordered array that you have seen in lectures (except that here the insertion point is specified). As a final step, you need to increment numcars, to reflect the presence of the extra car. Finally, add one more method (to the Road class): 4

5 public void update () { } Notice that this has an empty body. You will make it do something rather more interesting in part B. Testing A class called TestA has been supplied to help you to test your work in this part, before it is ready to work with the full simulation. Have a look at the details of the class. It creates a road, populates it with some cars, then prints out their details. To use it, you will need to compile the various classes. The command javac *.java will achieve this. Then, to run the part A test, you should issue the command java TestA Make sure that the resulting output makes sense (you will need to read TestA.java to check this). You might like to experiment by making changes to TestA.java and checking that the new output is as you would expect. Submission When you are happy that your new Road class is behaving correctly, you can submit this part for assessment with the following command: handin A4a Road.java Later submissions will overwrite earlier ones. There is no need to hand in the TestA.java file. Once you have made your submission, either delete TestA.java with the command rm TestA.java or rename it (in case you want it for reference) with the command mv TestA.java TestA.saved This will avoid the reporting of spurious compiler errors later on in the practical, when changes in other classes make the TestA class no longer applicable. Part B: Learning to drive We are now ready to simulate traffic flowing along the road, in one-second steps. First, read the move method in the Car class. This takes two arguments, the first being the distance that (the rear of) the car in front has travelled, and the second being the speed limit (as an integer) in force at the point on the road where the front of the car 5

6 is currently located. Based on these, the method works out the maximum acceptable speed (involving a careful driver rule which never attempts to cover more than one third of the distance to the car in front, the current speed limit, and an assumption on the car s powers of acceleration). Given this method for a single car, you should now write a new body for the update method in your Road class. This will update the entire state of the road for a onesecond time step. With it in place, you will be able to try a road simulation, using the Simulation class in the supplied Simulation.java file. There are three things that have to be done by the update method, in the following order: 1. Check whether there are any cars on the road and, if so, whether the car furthest along (in array element numcars-1) should now depart, i.e. whether its distance equals the road length or more. If so, remove it, just by decrementing numcars. 2. Update all the current cars, in positions numcars-1 down to 0, using their move methods. Hint: use a for-loop, counting down the array, and maintain a variable that records the distance, prior to updating, of the car ahead of the one being considered. There is no car ahead of the first car considered, of course, so initialise the variable to reflect an imaginary car that is well in front (say, in terms of Road fields, at distance 2*length metres). 3. Check whether there is space for a new car to join the road, that is, whether there are either no cars on the road or the distance of the car least far along (in array element 0) equals the standard car length or more. If so, create a new car object, at distance 0 and with speed 0, and insert it at array position 0 using the insertcar method you wrote in Part A. Testing As before, the command javac *.java will compile all your classes. Then, to run the simulation, issue the command java Simulation This will simulate 2000 seconds of road traffic, and then display a speedgram, which should look like the one in the appendix at the end of this handout. If debugging is needed, you may find it useful temporarily to change main to simulate only one second (i.e. only one use of your update method) or only the first few seconds. Submission When you are happy that your new Road class is behaving correctly, you can submit this part for assessment with the following command: handin A4b Road.java Later submissions will overwrite earlier ones. 6

7 Part C: Hazards In Part B, there were no hindrances on the road, so that the resulting speedgram shows a smooth flow of cars travelling at the speed limit. Now, we will investigate the introduction of a hazard causing a reduced maximum speed on a section of road. This might reflect a formal reduction in the speed limit, at roadworks for example, or might reflect drivers slowing down to inspect the scene of a police-related incident. You should now create a file called Hazard.java containing class definitions for an object representing such a slowdown. This should have three fields, all private. These are to be called start, duration and reducedlimit, and are all of type int. They are used to hold the starting point (in metres from the beginning of the road) and length (in metres) of the hazard, and the reduced speed limit applying. Add a constructor method public Hazard (int start, int duration, int reducedlimit) and inspector methods for each of the fields. You then need to make some changes to the SpeedLimit and Simulation classes, to add a slowdown. Firstly, in the SpeedLimit class, add an extra field called hazard which is a Hazard object, and add a matching second argument called hazard to the SpeedLimit constructor method, storing the provided value in the new field. Secondly, still in the SpeedLimit class, rewrite the limitat method so that it returns the current speed limit for the given distance (i.e. the normal limit if there is no hazard, or the distance lies outside the hazard, or the reduced limit if the distance lies inside the hazard). Finally, in the Simulation class, in the main method, replace the right-hand side of the statement that creates the new Road object by the following: new Road(20000, new SpeedLimit(40, new Hazard(15000, 20, 10))); This creates the road with a 20 metre long slowdown to 10 metres/second, starting at a point 3 of the way along. 4 Testing As before, the command javac *.java will compile all your classes. Then, to run the simulation, issue the command java Simulation The resulting speedgram should look like the one in the appendix. 7

8 Submission When you are happy that everything is behaving correctly, you can submit this part for assessment with the following command: handin A4c Hazard.java SpeedLimit.java Road.java Remember to hand in all three files. Later submissions will overwrite earlier ones. Part D: Merge points Finally, we investigate the introduction of an extra flow of traffic joining the road partway along. We shall assume good behaviour on the part of the incoming traffic, in that a new car will only ever join the road when there is ample space. We will make the arrival of new cars probabilistic. You should create a file called MergePoint.java containing class definitions for an object representing such a merge point. This should have a single field, to be called point, which is a private int, used to hold the point (in metres from the beginning of the road) at which the merge happens. Add a constructor method and an inspector method: public MergePoint (int point) public int getpoint () You then need to make some changes to the Road and Simulation classes. In the Road class, add an extra field called mergepoint which is a MergePoint object, add a matching fourth argument called mergepoint to the Road constructor method and store it in the corresponding field. Then, at the end of the update method, you should insert code to deal with the merge point as follows: 1. Search the array of cars, trying to find two adjacent elements (i +1 and i, say), where the first car is at or after the merge point and the second car is before it. 2. If the search succeeds, and there are at least three car lengths between the merge point and the rear of the car in front (to allow for the length of the new car itself), and also between the merge point and the front of the car behind, then with probability 0.8, a new car is created, with its rear at the merge point, travelling at the same speed as the car in front and inserted at array position i +1using the insertcar method. Note that you can generate a random floating point number in the range 0.0 to 1 by calling the library method Math.random(). In the Simulation class, in the main method, replace the right-hand side of the statement that creates the new Road object by the following: new Road(20000, new SpeedLimit(40, new Hazard(15000, 20, 10)), new MergePoint(10000)); This creates the road with a merge point half-way along. Test your completed changes by running the main method. The resulting speedgram should look very like the one in the appendix, with minor variations caused by the probabilistic merging. 8

9 Testing As before, use javac *.java to compile and java Simulation to run the simulation, checking that the output looks like the one given in the appendix. For this part only there will be minor variations from run to run, as a natural consequence of our probabilistic simulation of merging. Submission When you are happy that everything is behaving correctly you can submit this part for assessment with the following command handin A4d MergePoint.java Road.java Remember to hand in both files. Later submissions will overwrite earlier ones. Appendix - Speedgram examples Be careful: Some online viewers make a poor job of reproducing the illustrations. To be confident, you should compare your on-screen results with the versions from the printed handout. The horizontal axis of a speedgram represents the road, start at left, end at right. Each vertical line represents a car at that position, with height of line proportional to speed. Speedgram for Part B 9

10

School of Informatics, University of Edinburgh

School of Informatics, University of Edinburgh CS1Bh Practical 1 Words and Sentences This is an individual practical exercise which requires you to submit some Java programs and some text files for assessment. A system which measures software similarity

More information

CS2 Practical 2 CS2Ah

CS2 Practical 2 CS2Ah CS2 Practical 2 Finite automata This practical is based on material in the language processing thread. The practical is made up of two parts. Part A consists of four paper and pencil exercises, designed

More information

ASSIGNMENT 5 Objects, Files, and More Garage Management

ASSIGNMENT 5 Objects, Files, and More Garage Management ASSIGNMENT 5 Objects, Files, and More Garage Management COMP-202B, Winter 2010, All Sections Due: Wednesday, April 14, 2009 (23:55) You MUST do this assignment individually and, unless otherwise specified,

More information

Important Project Dates

Important Project Dates Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Fall 2002 Handout 4 Project Overview Wednesday, September 4 This is an overview of the course project

More information

Understanding and Exploring Memory Hierarchies

Understanding and Exploring Memory Hierarchies Understanding and Exploring Memory Hierarchies Issued : Thursday 27th January 2011 Due : Friday 11th March 2011 at 4.00pm (at the ITO) This assignment represents the total practical component of the Computer

More information

27-Sep CSCI 2132 Software Development Lab 4: Exploring bash and C Compilation. Faculty of Computer Science, Dalhousie University

27-Sep CSCI 2132 Software Development Lab 4: Exploring bash and C Compilation. Faculty of Computer Science, Dalhousie University Lecture 4 p.1 Faculty of Computer Science, Dalhousie University CSCI 2132 Software Development Lab 4: Exploring bash and C Compilation 27-Sep-2017 Location: Goldberg CS Building Time: Wednesday, 16:05

More information

CE221 Programming in C++ Part 1 Introduction

CE221 Programming in C++ Part 1 Introduction CE221 Programming in C++ Part 1 Introduction 06/10/2017 CE221 Part 1 1 Module Schedule There are two lectures (Monday 13.00-13.50 and Tuesday 11.00-11.50) each week in the autumn term, and a 2-hour lab

More information

ASSIGNMENT 5 Objects, Files, and a Music Player

ASSIGNMENT 5 Objects, Files, and a Music Player ASSIGNMENT 5 Objects, Files, and a Music Player COMP-202A, Fall 2009, All Sections Due: Thursday, December 3, 2009 (23:55) You MUST do this assignment individually and, unless otherwise specified, you

More information

CS2 Practical 6 CS2Bh 24 January 2005

CS2 Practical 6 CS2Bh 24 January 2005 CS2 Practical 6 Data Structures for Dictionaries This practical is based on material of the Algorithms and Data Structures thread. It has two parts: Part A, worth 40 marks, consists of four pen-and-paper

More information

CS 241 Data Organization using C

CS 241 Data Organization using C CS 241 Data Organization using C Fall 2018 Instructor Name: Dr. Marie Vasek Contact: Private message me on the course Piazza page. Office: Farris 2120 Office Hours: Tuesday 2-4pm and Thursday 9:30-11am

More information

Project 1: Empirical Analysis of Algorithms

Project 1: Empirical Analysis of Algorithms Project 1: Empirical Analysis of Algorithms Dr. Hasmik Gharibyan Deadlines: submit your files electronically by midnight (end of the day) on Friday, 1/19/18. Late submission: you can submit your work within

More information

Lab 1 1 Due Wed., 2 Sept. 2015

Lab 1 1 Due Wed., 2 Sept. 2015 Lab 1 1 Due Wed., 2 Sept. 2015 CMPSC 112 Introduction to Computer Science II (Fall 2015) Prof. John Wenskovitch http://cs.allegheny.edu/~jwenskovitch/teaching/cmpsc112 Lab 1 - Version Control with Git

More information

Due: 9 February 2017 at 1159pm (2359, Pacific Standard Time)

Due: 9 February 2017 at 1159pm (2359, Pacific Standard Time) CSE 11 Winter 2017 Program Assignment #2 (100 points) START EARLY! Due: 9 February 2017 at 1159pm (2359, Pacific Standard Time) PROGRAM #2: DoubleArray11 READ THE ENTIRE ASSIGNMENT BEFORE STARTING In lecture,

More information

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

Programming Standards: You must conform to good programming/documentation standards. Some specifics: CS3114 (Spring 2011) PROGRAMMING ASSIGNMENT #3 Due Thursday, April 7 @ 11:00 PM for 100 points Early bonus date: Wednesday, April 6 @ 11:00 PM for a 10 point bonus Initial Schedule due Thursday, March

More information

Introduction Welcome! Before you start Course Assessments The course at a glance How to pass M257

Introduction Welcome! Before you start Course Assessments The course at a glance How to pass M257 Introduction Unit 1: Java Everywhere Prepared by: Dr. Abdallah Mohamed, AOU-KW 1 Introduction Welcome! Before you start Course Assessments The course at a glance How to pass M257 1. Java background 2.

More information

Note: This is a miniassignment and the grading is automated. If you do not submit it correctly, you will receive at most half credit.

Note: This is a miniassignment and the grading is automated. If you do not submit it correctly, you will receive at most half credit. Com S 227 Spring 2018 Miniassignment 1 40 points Due Date: Thursday, March 8, 11:59 pm (midnight) Late deadline (25% penalty): Friday, March 9, 11:59 pm General information This assignment is to be done

More information

CS2 Practical 1 CS2A 22/09/2004

CS2 Practical 1 CS2A 22/09/2004 CS2 Practical 1 Basic Java Programming The purpose of this practical is to re-enforce your Java programming abilities. The practical is based on material covered in CS1. It consists of ten simple programming

More information

CP Lab 4: Simple graphics with descartes

CP Lab 4: Simple graphics with descartes CP Lab 4: Simple graphics with descartes 1 Note We know that quite a few of you have been having some difficulty with Labs 2 and 3. If that s you, then please don t try to do this lab now (in the lab sessions

More information

COL106: Data Structures, I Semester Assignment 7 A taxi aggregator service

COL106: Data Structures, I Semester Assignment 7 A taxi aggregator service COL106: Data Structures, I Semester 2016-17 Assignment 7 A taxi aggregator service October 22, 2016 Nowadays services like Ola and Uber have become very popular. These services aggregate the services of

More information

Prolog Assessed Exercise

Prolog Assessed Exercise Prolog Assessed Exercise David Eyers 21st April 2009 The purpose of this exercise is to implement in Prolog the Bellman-Ford algorithm for computing singlesource shortest paths

More information

ACORN.COM CS 1110 SPRING 2012: ASSIGNMENT A1

ACORN.COM CS 1110 SPRING 2012: ASSIGNMENT A1 ACORN.COM CS 1110 SPRING 2012: ASSIGNMENT A1 Due to CMS by Tuesday, February 14. Social networking has caused a return of the dot-com madness. You want in on the easy money, so you have decided to make

More information

Semester 2, 2018: Lab 1

Semester 2, 2018: Lab 1 Semester 2, 2018: Lab 1 S2 2018 Lab 1 This lab has two parts. Part A is intended to help you familiarise yourself with the computing environment found on the CSIT lab computers which you will be using

More information

Note: This is a miniassignment and the grading is automated. If you do not submit it correctly, you will receive at most half credit.

Note: This is a miniassignment and the grading is automated. If you do not submit it correctly, you will receive at most half credit. Com S 227 Fall 2018 Miniassignment 1 40 points Due Date: Friday, October 12, 11:59 pm (midnight) Late deadline (25% penalty): Monday, October 15, 11:59 pm General information This assignment is to be done

More information

Homework Assignment #3

Homework Assignment #3 CS 540-2: Introduction to Artificial Intelligence Homework Assignment #3 Assigned: Monday, February 20 Due: Saturday, March 4 Hand-In Instructions This assignment includes written problems and programming

More information

Instructions PLEASE READ (notice bold and underlined phrases)

Instructions PLEASE READ (notice bold and underlined phrases) Lab Exercises wk02 Lab Basics First Lab of the course Required Reading Java Foundations - Section 1.1 - The Java Programming Language Instructions PLEASE READ (notice bold and underlined phrases) Lab Exercise

More information

: Principles of Imperative Computation. Fall Assignment 5: Interfaces, Backtracking Search, Hash Tables

: Principles of Imperative Computation. Fall Assignment 5: Interfaces, Backtracking Search, Hash Tables 15-122 Assignment 3 Page 1 of 12 15-122 : Principles of Imperative Computation Fall 2012 Assignment 5: Interfaces, Backtracking Search, Hash Tables (Programming Part) Due: Monday, October 29, 2012 by 23:59

More information

Hands on Assignment 1

Hands on Assignment 1 Hands on Assignment 1 CSci 2021-10, Fall 2018. Released Sept 10, 2018. Due Sept 24, 2018 at 11:55 PM Introduction Your task for this assignment is to build a command-line spell-checking program. You may

More information

Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 14

Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 14 Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 14 Scan Converting Lines, Circles and Ellipses Hello everybody, welcome again

More information

Programming Assignment 8 ( 100 Points )

Programming Assignment 8 ( 100 Points ) Programming Assignment 8 ( 100 Points ) Due: 11:59pm Wednesday, November 22 Start early Start often! README ( 10 points ) You are required to provide a text file named README, NOT Readme.txt, README.pdf,

More information

An Introduction to Komodo

An Introduction to Komodo An Introduction to Komodo The Komodo debugger and simulator is the low-level debugger used in the Digital Systems Laboratory. Like all debuggers, Komodo allows you to run your programs under controlled

More information

Lab 4: On Lists and Light Sabers

Lab 4: On Lists and Light Sabers Lab 4: On Lists and Light Sabers Due: March 19th at 11:59pm Overview The goal of this lab is to familiarize yourself with the usage of Lists and their implementations, Array List and Linked. To do so,

More information

EE 422C HW 6 Multithreaded Programming

EE 422C HW 6 Multithreaded Programming EE 422C HW 6 Multithreaded Programming 100 Points Due: Monday 4/16/18 at 11:59pm Problem A certain theater plays one show each night. The theater has multiple box office outlets to sell tickets, and the

More information

CSC 1052 Algorithms & Data Structures II: Introduction

CSC 1052 Algorithms & Data Structures II: Introduction CSC 1052 Algorithms & Data Structures II: Introduction Professor Henry Carter Spring 2018 Programming This course... We will investigate a series of data structures and algorithms designed to solve common

More information

EECE.2160: ECE Application Programming

EECE.2160: ECE Application Programming Spring 2018 Programming Assignment #10: Instruction Decoding and File I/O Due Wednesday, 5/9/18, 11:59:59 PM (Extra credit ( 4 pts on final average), no late submissions or resubmissions) 1. Introduction

More information

Project 1: Implementation of the Stack ADT and Its Application

Project 1: Implementation of the Stack ADT and Its Application Project 1: Implementation of the Stack ADT and Its Application Dr. Hasmik Gharibyan Deadlines: submit your files via handin by midnight (end of the day) on Thursday, 10/08/15. Late submission: submit your

More information

EECE.2160: ECE Application Programming

EECE.2160: ECE Application Programming Fall 2017 Programming Assignment #10: Doubly-Linked Lists Due Monday, 12/18/17, 11:59:59 PM (Extra credit ( 5 pts on final average), no late submissions or resubmissions) 1. Introduction This assignment

More information

Soda Machine Laboratory

Soda Machine Laboratory Soda Machine Laboratory Introduction This laboratory is intended to give you experience working with multiple queue structures in a familiar real-world setting. The given application models a soda machine

More information

Initial Coding Guidelines

Initial Coding Guidelines Initial Coding Guidelines ITK 168 (Lim) This handout specifies coding guidelines for programs in ITK 168. You are expected to follow these guidelines precisely for all lecture programs, and for lab programs.

More information

Programming Assignment 1

Programming Assignment 1 CMPS 101 Algorithms and Abstract Data Types Programming Assignment 1 Introduction The purpose of this assignment is threefold: to make sure everyone is up to speed with Java, to practice modularity and

More information

Data Structure and Algorithm Homework #3 Due: 2:20pm, Tuesday, April 9, 2013 TA === Homework submission instructions ===

Data Structure and Algorithm Homework #3 Due: 2:20pm, Tuesday, April 9, 2013 TA   === Homework submission instructions === Data Structure and Algorithm Homework #3 Due: 2:20pm, Tuesday, April 9, 2013 TA email: dsa1@csientuedutw === Homework submission instructions === For Problem 1, submit your source code, a Makefile to compile

More information

Final Project: LC-3 Simulator

Final Project: LC-3 Simulator Final Project: LC-3 Simulator Due Date: Friday 4/27/2018 11:59PM; No late handins This is the final project for this course. It is a simulator for LC-3 computer from the Patt and Patel book. As you work

More information

Programming Assignment 2 ( 100 Points )

Programming Assignment 2 ( 100 Points ) Programming Assignment 2 ( 100 Points ) Due: Thursday, October 16 by 11:59pm This assignment has two programs: one a Java application that reads user input from the command line (TwoLargest) and one a

More information

Our second exam is Thursday, November 10. Note that it will not be possible to get all the homework submissions graded before the exam.

Our second exam is Thursday, November 10. Note that it will not be possible to get all the homework submissions graded before the exam. Com S 227 Fall 2016 Assignment 3 300 points Due Date: Wednesday, November 2, 11:59 pm (midnight) Late deadline (25% penalty): Thursday, November 2, 11:59 pm General information This assignment is to be

More information

ASSIGNMENT 5 Data Structures, Files, Exceptions, and To-Do Lists

ASSIGNMENT 5 Data Structures, Files, Exceptions, and To-Do Lists ASSIGNMENT 5 Data Structures, Files, Exceptions, and To-Do Lists COMP-202B, Winter 2009, All Sections Due: Tuesday, April 14, 2009 (23:55) You MUST do this assignment individually and, unless otherwise

More information

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

Assignment 3 ITCS-6010/8010: Cloud Computing for Data Analysis Assignment 3 ITCS-6010/8010: Cloud Computing for Data Analysis Due by 11:59:59pm on Tuesday, March 16, 2010 This assignment is based on a similar assignment developed at the University of Washington. Running

More information

CSSE2002/7023 The University of Queensland

CSSE2002/7023 The University of Queensland CSSE2002 / CSSE7023 Semester 1, 2016 Assignment 1 Goal: The goal of this assignment is to gain practical experience with data abstraction, unit testing and using the Java class libraries (the Java 8 SE

More information

CS211 Computers and Programming Matthew Harris and Alexa Sharp July 9, Boggle

CS211 Computers and Programming Matthew Harris and Alexa Sharp July 9, Boggle Boggle If you are not familiar with the game Boggle, the game is played with 16 dice that have letters on all faces. The dice are randomly deposited into a four-by-four grid so that the players see the

More information

ICOM 4015 Advanced Programming Laboratory. Chapter 1 Introduction to Eclipse, Java and JUnit

ICOM 4015 Advanced Programming Laboratory. Chapter 1 Introduction to Eclipse, Java and JUnit ICOM 4015 Advanced Programming Laboratory Chapter 1 Introduction to Eclipse, Java and JUnit University of Puerto Rico Electrical and Computer Engineering Department by Juan E. Surís 1 Introduction This

More information

VARIABLES. Aim Understanding how computer programs store values, and how they are accessed and used in computer programs.

VARIABLES. Aim Understanding how computer programs store values, and how they are accessed and used in computer programs. Lesson 2 VARIABLES Aim Understanding how computer programs store values, and how they are accessed and used in computer programs. WHAT ARE VARIABLES? When you input data (i.e. information) into a computer

More information

Tiny Instruction Manual for the Undergraduate Mathematics Unix Laboratory

Tiny Instruction Manual for the Undergraduate Mathematics Unix Laboratory Tiny Instruction Manual for the Undergraduate Mathematics Unix Laboratory 1 Logging In When you sit down at a terminal and jiggle the mouse to turn off the screen saver, you will be confronted with a window

More information

CS 241 Data Organization. August 21, 2018

CS 241 Data Organization. August 21, 2018 CS 241 Data Organization August 21, 2018 Contact Info Instructor: Dr. Marie Vasek Contact: Private message me on the course Piazza page. Office: Room 2120 of Farris Web site: www.cs.unm.edu/~vasek/cs241/

More information

Department of Computer Science. COS 122 Operating Systems. Practical 3. Due: 22:00 PM

Department of Computer Science. COS 122 Operating Systems. Practical 3. Due: 22:00 PM Department of Computer Science COS 122 Operating Systems Practical 3 Due: 2018-09-13 @ 22:00 PM August 30, 2018 PLAGIARISM POLICY UNIVERSITY OF PRETORIA The Department of Computer Science considers plagiarism

More information

CS164: Programming Assignment 2 Dlex Lexer Generator and Decaf Lexer

CS164: Programming Assignment 2 Dlex Lexer Generator and Decaf Lexer CS164: Programming Assignment 2 Dlex Lexer Generator and Decaf Lexer Assigned: Thursday, September 16, 2004 Due: Tuesday, September 28, 2004, at 11:59pm September 16, 2004 1 Introduction Overview In this

More information

Note: This is a miniassignment and the grading is automated. If you do not submit it correctly, you will receive at most half credit.

Note: This is a miniassignment and the grading is automated. If you do not submit it correctly, you will receive at most half credit. Com S 227 Fall 2017 Miniassignment 1 50 points Due Date: Monday, October 16, 11:59 pm (midnight) Late deadline (25% penalty): Tuesday, October 17, 11:59 pm General information This assignment is to be

More information

CS 116. Lab Assignment # 1 1

CS 116. Lab Assignment # 1 1 Points: 2 Submission CS 116 Lab Assignment # 1 1 o Deadline: Friday 02/05 11:59 PM o Submit on Blackboard under assignment Lab1. Please make sure that you click the Submit button and not just Save. Late

More information

Check the entries in the home directory again with an ls command and then change to the java directory:

Check the entries in the home directory again with an ls command and then change to the java directory: MODULE 1p - A Directory for Java Files FIRST TASK Log in to PWF Linux and check the files in your home directory with an ls command. Create a directory for your Java files: c207@pccl504:~> mkdir java Move

More information

16. Linked Structures and Miscellaneous

16. Linked Structures and Miscellaneous 16. Linked Structures and Miscellaneous The main purpose of this section is to look at the cool topic of linked data structures. This is where we use one object to point to the next object in a structure

More information

Announcements. Prelude (2) Prelude (1) Data Structures and Information Systems Part 1: Data Structures. Lecture 6: Lists.

Announcements. Prelude (2) Prelude (1) Data Structures and Information Systems Part 1: Data Structures. Lecture 6: Lists. Announcements MODULE WEB-SITE: http://www.csc.liv.ac.uk/ michele/teaching/comp102/comp102.html FIRST ASSIGNMENT DEADLINE: Wednesday, February 1st, 14.30, LAB 7 Boxes (late submissions to be left in the

More information

This assignment is worth 100 points and is due on the crashwhite.polytechnic.org server at 23:59:59 on the date given in class.

This assignment is worth 100 points and is due on the crashwhite.polytechnic.org server at 23:59:59 on the date given in class. AP Computer Science Partner Project - RideShare ASSIGNMENT OVERVIEW In this assignment you ll be creating a small package of files which will simulate a Ride Sharing system. The package will include four

More information

Programming Assignment 2 (PA2) - DraggingEmoji & ShortLongWords

Programming Assignment 2 (PA2) - DraggingEmoji & ShortLongWords Programming Assignment 2 (PA2) - DraggingEmoji & ShortLongWords Due Date: Wednesday, October 10 @ 11:59 pm Assignment Overview Grading Gathering Starter Files Program 1: DraggingEmoji Program 2: ShortLongWords

More information

Programming Project 5: NYPD Motor Vehicle Collisions Analysis

Programming Project 5: NYPD Motor Vehicle Collisions Analysis : NYPD Motor Vehicle Collisions Analysis Due date: Dec. 7, 11:55PM EST. You may discuss any of the assignments with your classmates and tutors (or anyone else) but all work for all assignments must be

More information

You should see something like this, called the prompt :

You should see something like this, called the prompt : CSE 1030 Lab 1 Basic Use of the Command Line PLEASE NOTE this lab will not be graded and does not count towards your final grade. However, all of these techniques are considered testable in a labtest.

More information

Programming Project 1

Programming Project 1 Programming Project 1 Handout 6 CSCI 134: Fall, 2016 Guidelines A programming project is a laboratory that you complete on your own, without the help of others. It is a form of take-home exam. You may

More information

ENCM 339 Fall 2017: Editing and Running Programs in the Lab

ENCM 339 Fall 2017: Editing and Running Programs in the Lab page 1 of 8 ENCM 339 Fall 2017: Editing and Running Programs in the Lab Steve Norman Department of Electrical & Computer Engineering University of Calgary September 2017 Introduction This document is a

More information

CS 211 Programming Practicum Fall 2018

CS 211 Programming Practicum Fall 2018 Due: Wednesday, 11/7/18 at 11:59 pm Infix Expression Evaluator Programming Project 5 For this lab, write a C++ program that will evaluate an infix expression. The algorithm REQUIRED for this program will

More information

Project #1 Seamcarve

Project #1 Seamcarve Project #1 Seamcarve Out: Thursday, January 25 In: It s no use, it s no use, we are doomed! You did it! You saved us, Perry the...cs16 Student -Doofenshmirtz 1 Installing, Handing In, Demos 1. To install,

More information

Assignment 1. CSI Programming Practice, Fall 2011

Assignment 1. CSI Programming Practice, Fall 2011 Assignment 1 CSI2110 01 Programming Practice, Fall 2011 Due date: 11:59pm, October 5 (Wednesday) 2011. Introduction The purpose of the first assignment is to get acquainted (1) with the Linux programming

More information

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG 1 Notice Reading Assignment Chapter 1: Introduction to Java Programming Homework 1 It is due this coming Sunday

More information

Regard as 32 runs of length 1. Split into two scratch files of 4 blocks each, writing alternate blocks to each file.

Regard as 32 runs of length 1. Split into two scratch files of 4 blocks each, writing alternate blocks to each file. Consider the problem of sorting the following file using two way external merge sort. Assume it consists of 8 blocks of 4 records each, and that main memory is only large enough to sort 1 block at a time.

More information

Buffer Manager: Project 1 Assignment

Buffer Manager: Project 1 Assignment Buffer Manager: Project 1 Assignment CMU Computer Science 415 Spring 2003 Database Applications January 27, 2003 Due: 8pm February 5, 2003 1 Administrivia You should work in groups of three for this assignment.

More information

Assignment 1: Understanding Branch Prediction

Assignment 1: Understanding Branch Prediction Assignment 1: Understanding Branch Prediction Computer Architecture Due: Monday, February 20, 2017 at 4:00 PM This assignment represents the first practical component of the Computer Architecture module.

More information

CSC209H Lecture 1. Dan Zingaro. January 7, 2015

CSC209H Lecture 1. Dan Zingaro. January 7, 2015 CSC209H Lecture 1 Dan Zingaro January 7, 2015 Welcome! Welcome to CSC209 Comments or questions during class? Let me know! Topics: shell and Unix, pipes and filters, C programming, processes, system calls,

More information

CPSC 150 Laboratory Manual. Lab 1 Introduction to Program Creation

CPSC 150 Laboratory Manual. Lab 1 Introduction to Program Creation CPSC 150 Laboratory Manual A Practical Approach to Java, jedit & WebCAT Department of Physics, Computer Science & Engineering Christopher Newport University Lab 1 Introduction to Program Creation Welcome

More information

COMP26120 Academic Session: Lab Exercise 2: Input/Output; Strings and Program Parameters; Error Handling

COMP26120 Academic Session: Lab Exercise 2: Input/Output; Strings and Program Parameters; Error Handling COMP26120 Academic Session: 2018-19 Lab Exercise 2: Input/Output; Strings and Program Parameters; Error Handling Duration: 1 lab session For this lab exercise you should do all your work in your COMP26120/ex2

More information

CS355 Hw 4. Interface. Due by the end of day Tuesday, March 20.

CS355 Hw 4. Interface. Due by the end of day Tuesday, March 20. Due by the end of day Tuesday, March 20. CS355 Hw 4 User-level Threads You will write a library to support multiple threads within a single Linux process. This is a user-level thread library because the

More information

Project 5 - The Meta-Circular Evaluator

Project 5 - The Meta-Circular Evaluator MASSACHVSETTS INSTITVTE OF TECHNOLOGY Department of Electrical Engineering and Computer Science 6.001 Structure and Interpretation of Computer Programs Fall Semester, 2005 Project 5 - The Meta-Circular

More information

CS4023 Week04 Lab Exercise

CS4023 Week04 Lab Exercise CS4023 Week04 Lab Exercise Lab Objective: We will use this lab to log in to our Linux accounts and to look at some simple programs that perform a few elementary system calls. By the end of the lab we will

More information

Eat (we provide) link. Eater. Goal: Eater(Self) == Self()

Eat (we provide) link. Eater. Goal: Eater(Self) == Self() 15-251: Great Theoretical Ideas Guru: Yinmeng Zhang Assignment 12 Due: December 6, 2005 1 Reading Comprehension (0 points) Read the accompanying handout containing Ken Thompson s Turing Award Lecture,

More information

CS 2110 Summer 2011: Assignment 2 Boggle

CS 2110 Summer 2011: Assignment 2 Boggle CS 2110 Summer 2011: Assignment 2 Boggle Due July 12 at 5pm This assignment is to be done in pairs. Information about partners will be provided separately. 1 Playing Boggle 1 In this assignment, we continue

More information

Molecular Statistics Exercise 1. As was shown to you this morning, the interactive python shell can add, subtract, multiply and divide numbers.

Molecular Statistics Exercise 1. As was shown to you this morning, the interactive python shell can add, subtract, multiply and divide numbers. Molecular Statistics Exercise 1 Introduction This is the first exercise in the course Molecular Statistics. The exercises in this course are split in two parts. The first part of each exercise is a general

More information

University of Pennsylvania Department of Electrical and Systems Engineering Digital Audio Basics

University of Pennsylvania Department of Electrical and Systems Engineering Digital Audio Basics University of Pennsylvania Department of Electrical and Systems Engineering Digital Audio Basics ESE250 Spring 2013 Lab 7: Psychoacoustic Compression Friday, February 22, 2013 For Lab Session: Thursday,

More information

Lab 03 - x86-64: atoi

Lab 03 - x86-64: atoi CSCI0330 Intro Computer Systems Doeppner Lab 03 - x86-64: atoi Due: October 1, 2017 at 4pm 1 Introduction 1 2 Assignment 1 2.1 Algorithm 2 3 Assembling and Testing 3 3.1 A Text Editor, Makefile, and gdb

More information

Tips from the experts: How to waste a lot of time on this assignment

Tips from the experts: How to waste a lot of time on this assignment Com S 227 Spring 2018 Assignment 1 100 points Due Date: Friday, September 14, 11:59 pm (midnight) Late deadline (25% penalty): Monday, September 17, 11:59 pm General information This assignment is to be

More information

L25: Modern Compiler Design Exercises

L25: Modern Compiler Design Exercises L25: Modern Compiler Design Exercises David Chisnall Deadlines: October 26 th, November 23 th, November 9 th These simple exercises account for 20% of the course marks. They are intended to provide practice

More information

Parallel Programming Pre-Assignment. Setting up the Software Environment

Parallel Programming Pre-Assignment. Setting up the Software Environment Parallel Programming Pre-Assignment Setting up the Software Environment Authors: B. Wilkinson and C. Ferner. Modification date: Aug 21, 2014 (Minor correction Aug 27, 2014.) Software The purpose of this

More information

Project #1 Seamcarve

Project #1 Seamcarve Project #1 Seamcarve Out: Thursday, January 24 In: This is real, this is me Im exactly where I m supposed to be, now Gonna let the light, shine on me Now I ve found, who I am There s no way to hold it

More information

Assignment 1: grid. Due November 20, 11:59 PM Introduction

Assignment 1: grid. Due November 20, 11:59 PM Introduction CS106L Fall 2008 Handout #19 November 5, 2008 Assignment 1: grid Due November 20, 11:59 PM Introduction The STL container classes encompass a wide selection of associative and sequence containers. However,

More information

Lab Assignment. Lab 1, Part 1: Stretches. Assignment Preparation. The Task. .. Spring 2008 CSC/CPE 365: Database Systems Alexander Dekhtyar..

Lab Assignment. Lab 1, Part 1: Stretches. Assignment Preparation. The Task. .. Spring 2008 CSC/CPE 365: Database Systems Alexander Dekhtyar.. .. Spring 2008 CSC/CPE 365: Database Systems Alexander Dekhtyar.. Lab 1, Part 1: Stretches Due date: April 1, at the beginning of lab period. Lab Assignment Assignment Preparation This is a pair programming

More information

And Parallelism. Parallelism in Prolog. OR Parallelism

And Parallelism. Parallelism in Prolog. OR Parallelism Parallelism in Prolog And Parallelism One reason that Prolog is of interest to computer scientists is that its search mechanism lends itself to parallel evaluation. In fact, it supports two different kinds

More information

Programming Assignment 5 (100 Points) START EARLY!

Programming Assignment 5 (100 Points) START EARLY! Programming Assignment 5 (100 Points) Due: 11:59PM Thursday, November 2 START EARLY! Mining is arduous and dangerous work. Miners need to be taught how to mine minerals in the most efficient manner possible.

More information

Second Year C and R Assignment

Second Year C and R Assignment Prof. R. Willingale January 16, 2017 University Road Leicester LE1 7RH Telephone +44-116-252-3556 Internet http://www.star.le.ac.uk/zrw Email zrw@le.ac.uk Contents 1 Introduction 2 2 The Investigation

More information

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 2: SEP. 8TH INSTRUCTOR: JIAYIN WANG

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 2: SEP. 8TH INSTRUCTOR: JIAYIN WANG CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 2: SEP. 8TH INSTRUCTOR: JIAYIN WANG 1 Notice Class Website http://www.cs.umb.edu/~jane/cs114/ Reading Assignment Chapter 1: Introduction to Java Programming

More information

CMPSCI 187 / Spring 2015 Implementing Sets Using Linked Lists

CMPSCI 187 / Spring 2015 Implementing Sets Using Linked Lists CMPSCI 187 / Spring 2015 Implementing Sets Using Linked Lists Due on Tuesday February 24, 2015, 8:30 a.m. Marc Liberatore and John Ridgway Morrill I N375 Section 01 @ 10:00 Section 02 @ 08:30 1 CMPSCI

More information

CS 463 Project 1 Imperative/OOP Fractals

CS 463 Project 1 Imperative/OOP Fractals CS 463 Project 1 Imperative/OOP Fractals The goal of a couple of our projects is to compare a simple project across different programming paradigms. This semester, we will calculate the Mandelbrot Set

More information

CS201 - Assignment 3, Part 2 Due: Wednesday March 5, at the beginning of class

CS201 - Assignment 3, Part 2 Due: Wednesday March 5, at the beginning of class CS201 - Assignment 3, Part 2 Due: Wednesday March 5, at the beginning of class For this assignment we will be developing a text-based Tic Tac Toe game 1. The key to this assignment is that we re going

More information

Final Programming Project

Final Programming Project Due Thursday, Dec. 7, at 5:00 pm Logistics This assignment should be completed in groups of 3. This is not optional -- you are not allowed to complete it on your own, or in groups of any other size. I

More information

Computer Science 1 Ah

Computer Science 1 Ah UNIVERSITY OF EDINBURGH course CS0077 COLLEGE OF SCIENCE AND ENGINEERING SCHOOL OF INFORMATICS Computer Science 1 Ah Resit Examination Specimen Solutions Date: Monday 1st September 2003 Time: 09:30 11:00

More information

This is a combination of a programming assignment and ungraded exercises

This is a combination of a programming assignment and ungraded exercises CSE 11 Winter 2017 Programming Assignment #1 Covers Chapters: ZY 1-3 START EARLY! 100 Pts Due: 25 JAN 2017 at 11:59pm (2359) This is a combination of a programming assignment and ungraded exercises Exercises

More information

Multidimensional Divide and Conquer 2 Spatial Joins

Multidimensional Divide and Conquer 2 Spatial Joins Multidimensional Divide and Conque Spatial Joins Yufei Tao ITEE University of Queensland Today we will continue our discussion of the divide and conquer method in computational geometry. This lecture will

More information

TTh 9.25 AM AM Strain 322

TTh 9.25 AM AM Strain 322 TTh 9.25 AM - 10.40 AM Strain 322 1 Questions v What is your definition of client/server programming? Be specific. v What would you like to learn in this course? 2 Aims and Objectives v Or, what will you

More information