Monthly Schedule

(Introduction to Programming Languages, Period F)

W 2/1/012

HW due: Review your class notes, the lists of terms at the ends of Chapter 1 and Chapter 2 in the text, and the list of Java keywords (§3.9 only). A quiz is likely.

 

Th 2/2/012

Test (100 pts.) on all material covered so far.

Study guide (list of topics):

 

·         Chapters 1 and 2, especially the lists of terms at the end of each chapter

·         “Bits, Bytes, Hex, and Hertz” as covered in class

·         2’s complement addition and subtraction

·         Moore’s Law

·         Logic gates (AND, OR, NOT, NAND, NOR, XOR)

·         All other bits and snippets of knowledge discussed in class (e.g., Alan Turing, father of computer science).

 

F 2/3/012

HW due: Sleep! Sleep! Sleep!

 

M 2/6/012

HW due:

1. Read Chapter 3. Reading notes are required, as always.

2. Write Exercise 3.2 #1 on pp. 37-38. Try to do this, at least at first, without compiling the code as a Java class.

3. (Optional.) If you wish, you can then run the code for Exercise 3.1 on a computer and see if the results match your prediction.

 

T 2/7/012

No class.

 

W 2/8/012

HW due: Write Exercises 2.2, 3.3, and 3.4. Make printouts (or neat hand transcriptions) of your source code. Mr. Hansen will be available Tuesday afternoon from 12:30 to 1:25 if you need extra help.

 

Th 2/9/012

HW due: Read Chapter 4 (pp. 39-47). Reading notes are required, as always. If you have not finished the previously assigned exercises, make sure they are also clean and complete, including the method calls and passed parameter values.

 

F 2/10/012

HW due:

1. Write exercise 4.2 on p. 47 (all 4 parts). For part 4, make a prediction and write your prediction down. Then, compile and run the program, and write down the actual output. How close were you?

2. Memorize the month codes: 0 3 3 6 1 4 6 2 5 0 3 5. Use any system you wish. One possibility is Jazz, Femme, Ma’am, Apish, Maid, Junior, Judge, Augustine, Sell, Octopus, NoveMber, Dell.

3. Write a little bit more of the flowchart we started to construct in class (1 or 2 additional steps). Diamonds are used for decisions: branches coming out of the diamond will follow the “Y” path if the condition is true, the “N” path if the condition is false. Rectangles denote ordinary statements, and parallelograms denote input/output. We will complete the flowchart in class before we start to program the day-of-the-week app.

 

M 2/13/012

HW due: Finish your flowchart for the day-of-the-week app (DOTWAPP). The description of the algorithm tells you, in a straightforward text format, exactly what you need to do. However, you will need to translate the steps into flowchart style, using rectangles to denote ordinary statements, parallelograms for input/output, and diamonds for decision points (“if” statements). See xkcd.com for a humorous example of flowcharting as applied to the software development process in general.

 

T 2/14/012

No class.

 

W 2/15/012

HW due: Start writing your DOTWAPP (Day-Of-The-Week App) Java code, using your flowchart as a guide. Don’t worry, we will review all the code in class before we consider this exercise to be finalized. Requirements are listed below. If you can’t meet all of these requirements in the first version, then treat them as goals to work toward in the second version.

Requirements:

1. The description of the algorithm specifies most of the technical aspects of the app.
2. The app must accept all valid dates from 01/01/1901 through 12/31/2099 and must degrade gracefully (i.e., with an informative error message) for any invalid input.
3. The month-code lookup (0 3 3 6 1 4 6 2 5 0 3 5) and day-name lookup (0=Sunday, 1=Monday, 2=Tuesday, etc.) are to be implemented as Java methods so that when we have better techniques, we can simply replace the methods without having to modify any other aspects of the program.
4. Invalid lookups should never occur if the program is operating properly. However, you should include lines of code to produce a message saying “INTERNAL ERROR in ______ method” in the event that one of these supposedly “impossible” conditions ever occurs.
5. Your code should use meaningful variable names and a sprinkling of helpful comments to improve readability and maintainability.
6. Appropriate use of indentation and whitespace (blank lines) between methods will be expected.

Bring a hard copy of your code to class so that we can have a round-robin code review. Don’t worry if your code is not perfect yet; that is how we learn.

 

Th 2/16/012

HW due: Bring a revised (new and improved!) hard copy of your DOTWAPP code to class for code review.

Quiz will cover recent discussion topics: Software engineering methodology, flowchart shapes, and terminology such as regression testing and requirements creep.

 

F 2/17/012

No school.

 

M 2/20/012

No school.

 

T 2/21/012

No class.

 

W 2/22/012

HW due:

1. Read Chapter 6 (pp. 55-69).
2. Write Exercise 4.5. Note: When you write the raiseToPow method, make it recursive. Do not use the Math.pow function for now. For example, Math.pow(2,3) returns 23 = 8.0, but that does not provide the same educational benefit. In a “real” program, we would use Math.pow, of course, but for today, we want to program the raiseToPow method as a method that takes “int” inputs and also returns an “int” through the use of recursion. In other words, you will be using ideas from Chapter 6 as you solve Exercise 4.5.

If you get stuck, keep trying for awhile, but at some point you need to contact a classmate or send e-mail to Mr. Hansen. It is normal to get stuck; be sure you don’t stay that way for too long, that’s all.

A certain amount of being stuck helps your learning, because when you get “unstuck,” you will be more likely to remember how you did it than if you had someone guiding you every step of the way. The trick is to find the right balance: Stay stuck for a period of time, but not too long, before asking for help.

 

Th 2/23/012

HW due: Same as yesterday. Try to make your raiseToPow method accept 2 “int” arguments and return an “int.” For example, we would like raiseToPow(2,3) to return 8, much as Math.pow(2,3) returns 8.0.

 

F 2/24/012

HW due: Read Chapter 7 (pp. 75-87). Take some reading notes, as always.

 

M 2/27/012

HW due: Write Exercises 7.1 and 7.4 on pp. 87-88. Your next test will be on Thursday, March 1, and we will spend all day in class on Wednesday reviewing for the test.

 

T 2/28/012

No class. Mr. Hansen will be available for one-on-one consultation in MH-102.

 

W 2/29/012

HW due: Complete your DOTWAPP programming, to the best of your ability. Call the day-of-the-week calculation as a method (named dotwapp) from a main routine (shown below) that includes at least the 4 test dates given, plus 2 or 3 additional dates of your own choice. Note that the input is to be passed as an “int” in YYYYMMDD format. Since an “int” in Java is a dword (32 bits) and can therefore accommodate integers up to more than 2 billion, you will have plenty of capacity to deal with an 8-digit YYYYMMDD integer.

public static void main(String[] args) {

System.out.print("Day of the week for 19680131 equals ");

System.out.println(dotwapp(19680131));

System.out.print("Day of the week for 19000229 equals ");

System.out.println(dotwapp(19000229)); // should give error message

 

System.out.print("Day of the week for 20010911 equals ");

System.out.println(dotwapp(20010911));

System.out.print("Day of the week for 18841225 equals ");

System.out.println(dotwapp(18841225)); // should give error message

}

 

 

 


Return to the IPL Zone

Return to Mr. Hansen’s home page

Return to Mathematics Department home page

Return to St. Albans home page

Last updated: 20 Apr 2012