Take Final Exam in class on December 11, 1:00pm-3:00pm

Project 6 was due on December 2


CS 152 - Computer Science II

Fall-2019

Classes: MW 1:40pm - 2:55pm, Maria Sanford Hall 221
Instructor: Dr. Zdravko Markov, 30307 Maria Sanford Hall, (860)-832-2711, http://www.cs.ccsu.edu/~markov/, e-mail: markovz at ccsu dot edu
Office hours: MW 4:30pm-6:00pm, TR 1:30pm-3:00pm

Catalog description: Computer Science II Prereq.: CS 151 and MATH 152. Further topics in object-oriented programming: inheritance, polymorphism, and Java interfaces. Event- driven programming. Elementary searching and sorting techniques. Recursion. Design with UML diagrams. Introduction to software engineering.

Prerequisites: CS 151 and MATH 152

Course Learning Outcomes. The students will learn to:

Required textbook: Lewis & Loftus, Java Software Solutions: Foundations of Program Design, 9-th Edition, Addison-Wesley, 2017.

Required software: BlueJ - an integrated Java programming environment (www.bluej.org)

Class Participation: Regular attendance and active class participation is expected from all students. If you must miss a test, try to inform the instructor of this in advance.

Assignments and tests: Reading and problem assignments are listed under the schedule of classes. Some of the problems will be worked in class. There will be quizzes, two tests and a final exam. They will include material from the textbook, the lectures, and the programming projects.

Programming projects:There will be 6 programming projects requiring the use of BlueJ to write and run Java programs. The projects with their due dates are listed below in the schedule of classes. All projects must be submitted through the class page in Blackboard Learn course management system at https://ccsu.blackboard.com/.

Grading: The final grade will be based on projects (50%), quizzes (10%), tests (20%), and the final exam (20%), and will be affected by classroom participation, conduct and attendance. The letter grades will be calculated according to the following table:
A A- B+ B B- C+ C C- D+ D D- F
95-100 90-94 87-89 84-86 80-83 77-79 74-76 70-73 67-69 64-66 60-63 0-59

Unexcused late submission policy: Projects submitted more than two days after the due date will be graded one letter grade down. Projects submitted more than a week late will receive two letter grades down. No submissions will be accepted more than two weeks after the due date.

Honesty policy: The CCSU honor code for Academic Integrity is in effect in this class. It is expected that all students will conduct themselves in an honest manner and NEVER claim work which is not their own. Violating this policy will result in a substantial grade penalty, and may lead to expulsion from the University. You may find it online at http://web.ccsu.edu/academicintegrity/. Please read it carefully.

Students with disabilities: Students who believe they need course accommodations based on the impact of a disability, medical condition, or emergency should contact me privately to discuss their specific needs. I will need a copy of the accommodation letter from Student Disability Services in order to arrange class accommodations. Contact Student Disability Services, Willard Hall, 101-04 if you are not already registered with them. Student Disability Services maintains the confidential documentation of your disability and assists you in coordinating reasonable accommodations with your faculty.

Tentative schedule of classes, assignments, projects and tests (by week)

Note: Due dates for classes, assignments, and tests may change (see also University Calendar). Additional material may be posted. Check the schedule regularly for updates!
  1. Aug 28, Sep 4, 9: Object Oriented Design and Arrays
  2. Sep 11, 16: Inheritance
  3. Sep 18, 23, 25: Polymorphism and sorting
  4. Sep 30: Review for Test 1 (Arrays, Inheritance, Visibility modifiers, Abstract classes, Polymorphism and Sorting, Chapters 8, 9, 10)
  5. Oct 2: Test 1
  6. Oct 7: Searching
  7. Oct 9: Introduction to Graphics
  8. Oct 14, 16, 21: More Graphics
  9. Oct 23: Polygons and polylines
  10. Oct 28, 30, Nov 4: Mouse and Key Events
  11. Nov 6: Test 2 (Review Topics)
  12. Nov 11: Exceptions
  13. Nov 13, 18, 20: Recursion
  14. Nov 25, Dec 2: Linked Lists
  15. Dec 4: Recursion in graphics
  16. Wednesday, December 11, 1:00pm-3:00pm: Final Exam (includes all topics, textbook sections, and programs listed in the syllabus except for Graphics)

Programming Project 1

Log on to Blackboard Learn to see and submit the project.

Programming Project 2

Log on to Blackboard Learn to see and submit the project.

Programming Project 3

Log on to Blackboard Learn to see and submit the project.

Programming Project 4

Log on to Blackboard Learn to see and submit the project.

Programming Project 5

Log on to Blackboard Learn to see and submit the project.

Programming Project 6

Log on to Blackboard Learn to see and submit the project.

Test 1 Sample Problems

1) What does the following code do?  Assume list is an array of int values, temp is some previously initialized int value, and c is an int initialized to 0.
for (int j = 0; j < list.length; j++)
  if (list[j] < temp) c++;

a) It finds the smallest value and stores it in temp
b) It finds the largest value and stores it in temp
c) It counts the number of elements equal to the smallest value in list
d) It counts the number of elements in list that are less than temp
e) It sorts the values in list to be in ascending order


2) An int array stores the following values (in that order): 9, 4, 12, 2, 6, 8, 18

a) Demonstrate how the array is sorted in ascending order by the Selection sort algorithm. Show the content of the array after each pass of the outermost loop of the algorithm.
b) Demonstrate how the array is sorted in ascending order by the Insertion sort algorithm. Show the content of the array after each pass of the outermost loop of the algorithm.
3)  The code below adds elements to an array of objects Numbers and then prints the array. Add declarations for: Numbers, x, gen, and n, and define the class Num with the minimum information so that the code below runs. Hint: gen is an instance of the Random class. Solution: Problem_3.java, Num.java.

      for (int i = 0; i < 10; i++)
     {
       x = gen.nextInt(100);
       Num n = new Num (x);
       Numbers.add(n);
     }

     for (int index = 0; index < Numbers.size(); index++)
        System.out.println (Numbers.get(index));
 

4)  The following program generates a list of parts each one defined with a name and an ID. Then it finds the ID of the part named “Part 4” and prints its ID. Define the class Part accordingly. Hint: Part must implement the Comparable interface (defining properly compareTo) and should also include a constructor and a method toString(). Solution: Items.java Part.java.

public class Items
{
   public static void main (String[] args)
   {
      Part [] list = new Part[6];
      Part target = new Part ("Part 4", 0);

      list[0] = new Part ("Part 1", 123);
      list[1] = new Part ("Part 2", 127);
      list[2] = new Part ("Part 3", 531);
      list[3] = new Part ("Part 4", 131);
      list[4] = new Part ("Part 5", 789);
      list[5] = new Part ("Part 6", 254);

      for (int i = 1; i < list.length; i++)
        if (list[i].compareTo(target) == 0)
           System.out.println(list[i]);
    }
}
 

5)  Consider the following partial class definitions:

  public class A
  {
   public int x1;
   private int y1;
   protected int z1;
  …
  }

  public class B extends A
  {
   public int x2;
   private int y2;
   protected int z2;
  …
  }

  public class C extends A
  {
   public int x3;
   private int y3;
  …
  }

  public class D extends B
  {
   public int x4;
   private int y4;
  …
  }

a) Draw a diagram showing the class hierarchy.
b) Explain the visibility (accessibility) of all variables.


GUI Review Topics