San Jose State University | CS 151 - OO Design Section 5 | Fall 2016

Homework 1 / Prerequisite Quiz

  1. Prepare a plain text file aboutme.txt with the following information:
    Your name:
    Your student ID:
    Your major:
    Your preferred email address: 
    Check one: [ ] Undergraduate, [ ] Graduate, [ ] Open university 
    Repeating the class? [ ] Yes, [ ] No
    Place and semester where you took a programming course in Java: 
    Course number and grade received:
    Place and semester where you took a course in data structures: 
    Course number and grade received:
    Time it took you to answer the two questions below:
    Did you ask anyone for help? [ ] Yes, [ ] No
  2. In Java, implement the method Strings.uniqueLetters(String str) that returns a string of those letters that only occur once in str, in the same order that they appear in the original. For example, uniqueLetters("harrasses") should return "he". Check your answer with CodeCheck
  3. Implement the method Encoding.morseCodes(int m, int n) that yields a set of all Morse code strings with m dots and n dashes. For example, morseCodes(2, 1) yields a set with ..- .-. ..- -.. in some order. Hint: Recursion. Start with a dot, and then what? Start with a dash, and then what? Check your answer with CodeCheck

Important: The point of this assigment is for you to demonstrate that you already know how to program. This is not a class for students who can't yet program. Do not ask anyone for help. If you need to ask someone for help, or if it takes you longer than an hour to do this assignment, do not take this class. Take CS46A/B instead.

Important: Make a Git repo for all your work in this class. Put your work for this homework into a folder hw1, i.e. the files aboutme.txt,, and

Add me as a contributor to your repo. My BitBucket and GitHub ids are cayhorstmann.

Send an email to with subject line

CS151 Repo

and the URL to your repo in the body of your message.

Important: If you are currently enrolled in the class, you must turn in a complete or partial solution to this assignment by the deadline, or you may be dropped from the class. If you are trying to add the class, you will receive an add code after you have turned in the assignment.