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
    Semester, instructor, and grade of your CS151 prerequisite: 
    Time it took you to answer the question below:
    Did you ask anyone for help? [ ] Yes, [ ] No
    If adding: [ ] Section 3, [ ] Section 4, [ ] Either
    
  2. Solve the problem below.
  3. Make a private 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, Op.java, Product.java, Read.java, and ExprTest2.java. Make sure these files do not have package declarations.
  4. Add me as a contributor to your repo. My BitBucket and GitHub ids are cayhorstmann.
  5. Send an email to Cay.Horstmann@sjsu.edu with subject line
    CS152 Repo
    and the URL to your repo in the body of your message. Also be sure that I can tell who you are from your email. Ever so often, I get an email where the sender is identified as something like GandalfTheUltimate or WildWeasel1989. That's not the professional presentation that we want to see from our graduates. If in doubt, use your SJSU email.
  6. Run these commands:
    cd /tmp
    git clone your repo studentrepo
    cd studentrepo/hw1
    for f in Expr Const Function Sum Rand ExprTest ; do curl -O http://horstmann.com/sjsu/spring2018/cs152/hw1/$f.java ; done
    javac -cp .:path to JUnit4/\* -Xlint:unchecked *.java
    java -cp .:path to JUnit4/\* org.junit.runner.JUnitCore ExprTest
    
    Make sure that you pass all five tests.
  7. There is no trust in this world. Add a screenshot to your repo that shows how you executed these commands, and the resulting output, in a file hw1/screenshot.png. (If you use the Lubuntu VM, you can run the scrot command to get a screen shot.)

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 and space becomes available.


You are given an interface Expr to evaluate expressions, a class Const that produces constant expressions, a class Rand that produces random integers, and an interface Function that defines a function with parameters and return value of type T.