CMSC 131
Sections 010X, 020X

12/10/13   There was an error on slide #15 of the inheritance slides that I posted earlier today. I corrected the problem and posted the slides again. If you downloaded them before 3:40PM today then you should re-acquire them now.

12/10/13   Final exam information: The final exam will be on 12/17/13 from 4:00PM to 6:00PM. There are two different rooms, depending on which section you are in. Both rooms are in the Armory building. If you are in the honors section, or if you are in sections 0201/0202/0203/0204 then your exam is in ARM 0126. If you are not in the honors section, but are in sections 0101/0102/0103/0104 then your final exam is in ARM 0131. Please arrive at 3:50 so that we can get started on time. Bring pencils and erasers.

12/10/13   Here are the slides that I used while covering inheritance in class. We will finish this material on Friday.

12/02/13   Regarding Lab #6: Unfortunately, the linuxlab system was malfunctioning during some of the lab sessions, but is working normally now. The assignment will still be graded, but I have extended the deadline to Wednesday 12/04 at 6:00PM. If you were not able to get this done during the lab, please finish it and submit it. The instructions are included in the comments of the sourcecode.

11/26/13   Project #7 has been posted.

11/16/13   Project #6 has been posted. Please note that the due date for this project is the last day of the Thanksgiving break, but we will be posting project #7 (the last project) on the first day of the Thanksgiving break. We hope that this overlap will give you flexibility in how you choose to manage your time. As always, we recommend starting the projects immediately and finishing as early as possible.

11/01/13   Project #5 has been posted!

11/01/13   Reminder: To see where you lost points on project "style" grading, just go to the submit server and look at the source code from your last submission. You will see comments from the grader within your code indicating what you've done wrong and how many points you've lost.

10/30/13   Regarding JUnit code submitted with projects: We will not be grading your JUnit test code for "style". Of course you are encouraged to use proper style for your own benefit, but style on JUnit tests will not be part of your grade.

10/23/13   Project #4 has been posted!

10/22/13   Project #3 note: A small bug was found in one of the release tests. I think it only affected one student, but you might want to check the status of your most recent release tested submission to see if the results have changed.

10/21/13   Regarding today's lab exercise, "Lab03": The due date has been moved to Tuesday 10/22 at 6:00PM due to a technical problem. The project was distributed with the JUnit 3 jar file, but we are using JUnit 4 this semester. It is okay if you used JUnit 3 for this assignment, but if you are trying to use JUnit 4 and you get a message saying "Access restriction...", try the following:
1. Right-click the project folder and select "properties". Click the item on the left that says "Java Build Path". Select the "Libraries" tab. Click the item "JUnit 3". Click the Remove button. Click OK to exit this dialog box.
2. Right-click the project folder and select "New, JUnit test case". Make sure "JUnit 4" is selected at the top. Create a test class with any name you want. When asked about adding the JUnit4 jar file, select "perform the following action". Click OK.

10/10/13   Project #3 has been posted. Note that this is a CLOSED project!

10/05/13   The linuxlab system was down for a while this morning. The problem has been corrected. I have extended the deadline on project #2 until Monday at 11:00PM.

10/05/13   Please do not forget that Midterm #1 will be on Wednesday during your discussion section. We will have lecture on Wednesday as usual so be sure to attend!

09/27/13   Project #2 has been posted! Note that the due date is Sunday 10/6.

09/21/13   There is a way to have Eclipse automatically draw a vertical line in the editor at exactly the 80th column. (That way you can easily check that your lines are all less than 80 characters long, which is a requirement for project submissions.) Try this: Right-click inside the editor, then choose Preferences, General, Editors, Text Editors. You'll see a checkbox called "show print margin". Check this box, and enter the value 80 in the box below that says Print margin column.

09/21/13   If you have a laptop, please bring it with you to the discussion sessions on Mondays, including Monday this week. You will be doing practice problems in class on Mondays, many of which will be submitted for a grade. If you don't have your own laptop, we can loan you one, but it saves time if you have your own.

09/18/13   Project #1 has been posted! Click the Projects tab for the link to the project description.

09/12/13   Examples from yesterday's lecture have been distributed to your CVS repository. We will continue to distribute all coding examples from the lectures in this way. Please go to CVS perspective and "check out" the project called 131Fall2013Lec04Examples. The best way to learn this material is to experiment with our examples and then to try coming up with similar things on your own.

09/08/13   Wednesday's lab (discussion section) will be dedicated to helping students who are having trouble with Project #0. If you have already successfully submitted the project then you are excused from this lab session.

09/08/13   The due date for Project #0 has been moved to Wednesday 9/11.

08/31/13   The first lecture will be on Wednesday of this week, but the discussion session that day is cancelled.

08/27/13   All CMSC131 students are required to attend the discussion session in which they are officially registered.

08/27/13   Note that this website is for sections 0101, 0102, 0103, 0201, 0202, 0203, and 0204 ONLY.

08/27/13   Welcome to CMSC 131 (sections 010X and 020X) for the Fall 2013 Semester. Important announcements will appear here as the semester goes on. Be sure to look every day.


This is a first programming course for Computer Science majors with a focus on object-oriented programming. The goal of the course is to develop skills such as program design and testing as well as the implementation of programs using a graphical IDE. All programming will be done in Java.

Course Coordinator: Fawzi Emad

Recommended Text: Java Foundations

Major Topics
  • Intro to Computer Systems
  • Programming Basics:  Variables, Operators, Expressions, Statements, Methods
  • Java Text Input/Output
  • Conditionals
  • Loops
  • Principles of Object Oriented Programming
  • Basics of Program Design
  • Testing and Debugging
  • Java Memory Map
  • Arrays and Java ArrayLists
  • Java interfaces
  • Inheritance
  • Polymorphism


There will be eight programming projects and other assignments to be completed during the lab sessions.  Some are considered "closed" assignments which you must complete by yourself and others are considered "open" assignments where collaboration is permitted. (More information about the open policy will be provided in class and can be found in the Policy Regarding Open/Closed Projects.) There will also be two midterms, a final exam, and occasional quizzes.


All assignments can be done on the machines of your choice. You are welcome to do the work on a home computer if you have one. There should not be any machine-specific dependencies in your code. If we are not able to run your program because there is a difference between your and our computer environments, you must work with us to get your program to work in our environment.  You are expected to use the Eclipse IDE for all programming assignments.


All assignments must be submitted before 11pm on the day they are due. They are to be submitted electronically according to instructions given with the assignments. Late assignments will be strictly penalized. Exceptional circumstances will be considered only if discussed with the instructor before the assignment is due. Late assignments will have points deducted as follows:

  • 20 points are subtracted from your total if submitted within 24 hours.
  • No late assignments will be accepted after 24 hours.

Final grades will be computed according the following weights. (These weights are tentative and subject to future adjustment.)

40% Projects (8)       [The weights of the individual projects are: 1%, 3%, 5%, 5%, 6%, 6%, 7%, 7%]
15% Lab assignments (quizzes & exercises to be completed during your discussion sessions)
11% Midterm #1
11% Midterm #2
23% Final Exam

Academic Honesty

Note that academic dishonesty includes not only cheating, fabrication, and plagiarism, but also includes helping other students commit acts of academic dishonesty by allowing them to obtain copies of your work. You are allowed to use the Web for reference purposes, but you may not copy code from any website or any other source. In short, all submitted work must be your own.

Cases of academic dishonesty will be pursued to the fullest extent possible as stipulated by the Office of Student Conduct. Without exception every case of suspec\ ted academic dishonesty will be referred to the Office. If the student is found to be responsible of academic dishonesty, the typical sanction results in a special grade "XF", indicating that the course was failed due to academic dishonesty. More serious instances can result in expulsion from the university. If you have any doubt as to whether an act of yours might constitute academic dishonesty, please contact your TA or the course coordinator.

The University of Maryland, College Park has a nationally recognized Code of Academic Integrity, administered by the Student Honor Council.B This code sets standards for academic integrity at Maryland for all undergraduate and graduate students. As a student you are responsible for upholding these standards for this course. It is very important for you to be aware of the consequences of cheating, fabrication, facilitation, and plagiarism. For more information on the Code of Academic Integrity or the Student Honor Council, please visit

To further exhibit your commitment to academic integrity, remember to sign the Honor Pledge on all examinations and assignments: "I pledge on my honor that I have not given or received any unauthorized assistance on this examination (assignment)."
Excused Absence and Academic Accommodations
  1. Any student who needs to be excused for an absence from a single class session , due to a medically necessitated absence shall:
    • Make a reasonable attempt to inform the instructor of his/her illness prior to the class. If you are going to miss an in-class assignment then we expect to hear from you (either email or telephone message) before the class session begins.
    • Upon returning to the class, present their instructor with a self-signed note attesting to the date of their illness. The note must contain an acknowledgment by the student that the information provided is true and correct. Providing false information to University officials is prohibited under Part 9(h) of the Code of Student Conduct (V-1.00(B) University of Maryland Code of Student Conduct) and may result in disciplinary action.
    • This self-documentation may not be used for the Major Scheduled Grading Events as defined below and it may only be used for one class meeting during the semester.

  2. Any student who needs to be excused for more than one absence, or for a "Major Scheduled Grading Event", must provide written documentation of the illness from the Health Center or from an outside health care provider. This documentation must verify dates of treatment and indicate the timeframe that the student was unable to meet academic responsibilities. The documentation should be given to the instructor, not the TA. We will not accept a "self-signed" note for "major scheduled grading events", as defined below. The note must be signed by a health care professional.

    The Major Scheduled Grading Events for this course include:
    • Midterm #1
    • Midterm #2
    • Final Exam
    • Programming projects

It is also the student's responsibility to inform the instructor of any intended absences from exams for religious observances in advance. Notice should be provided as soon as possible but no later than one week prior to the exam.

Disability Support Services
Any student eligible for and requesting reasonable academic accommodations due to a disability is requested to provide, to the instructor in office hours, a letter of accommodation from the Office of Disability Support Services (DSS) within the first two weeks of the semester.

Course Evaluations

The Department of Computer Science takes the student course evaluations very seriously. Evaluations will usually be open during the last few weeks of the course. Students can go to to complete their evaluations. 

Exam Dates:
  • Midterm #1 Wednesday 10/09 in discussion section
  • Midterm #2 Wednesday 11/20 in discussion section
  • Final Exam Tuesday 12/17, 4:00 - 6:00pm.  Location to be announced.

Lecture Schedule (Approximate):
Week 1
Introduction to course; Course tools Demo of Eclipse IDE; Computer systems overview; Hardware; Memory
Week 2
Operating systems; Software languages; What is Object Oriented Programming? Why Java? Simple coding examples; Text output; Variables and assignment Primitive types; Strings; Arithmetic operators; Comparison operators
Week 3
Last day for schedule adjustment
Input via the Scanner; If and if/else statements; Logical operators
More details on if and if/else statements; Rules for Java identifiers Camel case convention; Symbolic constants; while loops; do-while loops
Week 4
For-loops; Blocks; Nesting of loops Writing static methods; Increment/decrement; Other assignment operators Rules of precedence; Short-circuiting; Widening/narrowing conversions; Intro to design
Week 5
Intro to objects and classes; Instance members Java memory model (call stack and heap); Garbage collection; equals method; Begin example of detailed Java class ("Student") Continue "Student" example; Constructors; toString; equals
Week 6
Review for Midterm Midterm #1 in Lab
More about static members vs. instance members
Variable initialization; JUnit testing
Week 7
Commenting; Call stack (frames, etc.); Java keyword "this" Visibility; Encapsulation; "API" Round-off errors; Intro to Java packages; Java libraries
Week 8
Details of String class; Math class; break; continue Exception handling (throw, try/catch) More exception handling (finally); Begin review example: "Password" class
Week 9
Continue "Password" example; Mutability; StringBuffer Eclipse debugger Arrays
Week 10
More details on arrays; Arrays of references Privacy leaks; Copying arrays (reference/shallow/deep copies); Two-dimensional arrays (ragged) Rectangular two-dimensional arrays; Java interfaces; Polymorphism
Week 11
Last day to drop with a 'W'
Wrappers; Examples using Java interfaces
Complexity (Big-O) Project design; Method overloading
Week 12
Review for Midterm Midterm #2 in Lab
Continue method overloading; Ternary conditional operator
Switch statements; Command-line Java; Javadoc
Week 13
Data structures; Syntax for using Java generic collections; Stack; ArrayList "Fun Day" (Topics to be announced...) Thanksgiving Break
Week 14
For-each loops; Java packages; package visibility Overview of inheritance Inheritance (with conceptual example)
Week 15
More about inheritance (Memory model; "super", etc.) Even more about inheritance (dynamic binding, etc.); Why no multiple inheritance? Review for final exam

Fawzi Emad
Office: 1201 A.V. Williams
Office Hours: MWF 8:00-8:50

Teaching Assistants
 EmailResponsibilitiesOffice Hours
Victoria Cepeda Grader (See table below)
Mohamed Guenady Grader (See table below)
Isaac Julien Honors section (See table below)
Byung (Eddie) Kim Sections 0101, 0102 (See table below)
Hitesh Maidesani Sections 0201, 0202 (See table below)
Meethu Malu Sections 0103, 0104 (See table below)
Nathan Yang Section 0204 (See table below)
Joan Zhang Section 0203 (See table below)
Hao Zhou Grader (See table below)

TA Office Hours Schedule

Students in sections 010X and 020X may visit any TA on this list.

All TA office hours take place in room 1112 A.V. Williams. Please note that a TA may need to leave 5 minutes before the end of the hour in order to go to his/her class. Please be understanding of their schedules.

9:00   Eddie   Meethu  
10:00 Isaac Eddie Victoria Meethu Eddie
11:00   Meethu Victoria Eddie  
12:00   Meethu Victoria Eddie  
1:00 Nathan Victoria Mohamed Isaac Hitesh
2:00 Nathan Victoria Mohamed   Mohamed
3:00 Joan & Hitesh   Joan & Hitesh   Mohamed
4:00 Hitesh   Hitesh Meethu Mohamed
Online Course Tools
  • Grades Server. This is where you go to see grades on assignments and to get your class account informtion.
  • Submission Server. This is where you go to view your project submissions and to get limited feedback about how your project is performing on our automated tests.
  • Eclipse Tutorial. Eclipse is an Integrated Development Environment (IDE) that helps us to write software efficiently. You will use Eclipse to implement the class projects this semester. See the section at the bottom of this page for specific information about setting up Eclipse.

About Java

The following web pages provide detailed references to information about Java.

  • Oracle's "Code Conventions". Guide for proper style when programming in Java.
  • Oracle's Java Homepage. This is the place to come when you really need the latest technical specs and downloads.
  • Oracle's Java Tutorial. This page has a number of links to books and web pages about Java, which you may find of interest.
  • Java SDK 6.0 General Documentation. This page contains technical documentation for the Java Software Development Kit (JDK), which includes the Java compiler and the associated libraries.
  • Java 6.0 API Specs. This page contains (javadoc) documentation for the Java libraries. It is an excellent reference and you should bookmark it on your browser.

Setting up Eclipse

In order to complete the projects for this course you must install Eclipse following the instructions in the Eclipse Tutorial. Note that if you install Eclipse from some other source then you will not be able to submit your projects easily!

After you get Eclipse installed, you will need to connect Eclipse to your class account. To the right is a screenshot of the information you will need to enter into the CVS connection dialog box during this process.

You can cut and paste the following lines into the dialog box:

  • Host:

  • Repository Path:
    (Replace "cs131XXX" with your personal login ID.)

Be sure to change the connection type to "extssh", as shown.

Below are collections of questions and practice problems that are designed to help you to learn the course material. These exercises are not being collected or graded. Answers are provided, but please try your best to solve each problem before looking at the solution! The list will be updated as the semester progresses.

Disclaimer: Your primary resource for studying should be the notes that you have taken during lectures! There will be questions on quizzes and exams that are not in any way represented in this study list. There will be questions on this study list that are not in any way represented on quizzes or exams. Please be aware that exam questions tend to combine more elements into a single question and many of the questions on the list are simpler than questions you will see on your exams. You may discuss these questions openly with anyone, including your classmates. If you are unsure about how the answer to any particular question is obtained, please drop by office hours for help. That's why we're here!

Week 1:  Questions Answers
Week 2:  Questions Answers
Week 3:  Questions Answers
Week 4:  Questions Answers
Week 5:  Questions Answers
Week 6:  Questions Answers
Week 7:  Questions Answers
Week 8:  Questions Answers
Week 9:  Questions Answers
Week 10:  Questions Answers
Week 11:  Questions Answers
Week 12:  Questions Answers
Week 13: Questions Answers

To submit a project, go to the "Java" perspective in Eclipse. Right click on the project folder (e.g., p1) and select "Submit Project" from the pull-down menu. If you do not see the "Submit Project" option then your copy of Eclipse does not contain the class plug-ins. In this case, please see the Eclipse installations instructions on the Resources page, or drop by TA office hours for help.

You may submit many times (we grade only the last submission). You can check the status of your submissions by visiting the Submit Server Home Page and entering your University Directory ID and password.

Important: Your grade for each project will be based on the greater value of two scores: (1) The score on the very last submission prior to the deadline; (2) The score minus 20% on the very last submission prior to the late deadline (up to 24 hours late).

Click the name of a project below to see the project specification.

Project Name Due Date
Hello World! Wednesday 09/11, 11:00PM
Maryland Football Saturday, 09/28, 11:00PM
Flags of the World Monday 10/07, 11:00PM
Medieval Soldiers Tuesday 10/22/13, 11:00PM
Mandelbrot Set Sunday 11/03/13, 11:00PM
Poker Simulator Friday 11/15/13, 11:00PM
Cafe 131 Sunday 12/01/12, 11:00PM
Fish Club Thursday 12/12/13

Web Accessibility