Presentation is loading. Please wait.

Presentation is loading. Please wait.

Reviewing for Exam Lecture 1?.

Similar presentations


Presentation on theme: "Reviewing for Exam Lecture 1?."— Presentation transcript:

1 Reviewing for Exam Lecture 1?

2 Lab 1 Postfix.java Questions? Hexadecimal System.exit(3);
Converting ‘a’ to number Converting ‘1’ to number System.exit(3); Questions?

3 Lecture 1 Test cases for programs Documentation Echo of input
Inline comments Ending message Javadocs

4 Lab 2 PseudoWar game Required Test cases Stubs Program Constructors
Specific methods Generation of number in range 1 to 52

5 Lab 3 Exception Handlers Avoiding Try Catch printStackTrace()
getMessage() Multiple handlers Avoiding

6 Lecture 3 Style guidelines Chapter12 slides

7 Lab 4 Writing code from scratch Illustrating use of exception handlers
Illustrating avoidance of exceptions Java Tutorial Java api

8 ArithmeticException ArrayIndexOutOfBoundsException FileNotFoundException PatternSyntaxException ClassNotFoundException InputMisMatchException NullPointerException NumberFormatException StringIndexOutOfBoundsException NegativeArraySizeException ArrayStoreException MalformedURLException IOException IllegalArgumentException ClassCastExceptionIllegal FormatConversionException

9 Lecture 4 Common Exceptions Reading from Files Compile time errors
That can be avoided That can not be avoided Reading from Files Compile time errors Runtime errors

10 Lab 5 File I/O Use of command line arguments Use of re-direct symbols
PrintWriter (flush) File java.io package Use of command line arguments Use of re-direct symbols

11 Lecture 5 Play with text examples
Use of StringTokenizer Use of delimiters Use of regular expressions Correct use of Boolean in if and while statements How comments help

12 Lab 6 Enumerated types Enhanced for loop (i.e. for… each)

13 Lecture 6 public enum Sessions { SPRING, SUMMER, FALL ; }

14 public enum Planet { MERCURY (3.303e+23, e6), VENUS (4.869e+24, e6), EARTH (5.976e+24, e6), MARS (6.421e+23, e6), JUPITER (1.9e+27, e7), SATURN (5.688e+26, e7), URANUS (8.686e+25, e7), NEPTUNE (1.024e+26, e7); for (Planet p : Planet.values()) System.out.printf ("Your weight on %s is %f%n", p, p.surfaceWeight(mass));

15 Lab 7 Enumerated types again Order Valid elements Attributes Rank Suit
Card Deck (?) Order Valid elements Attributes

16 Example for-each for (Rank r : Rank.values()) { System.out.println
r.getBridgePoints() + " " + r.getAbbreviation() ); } // end for

17 Lecture 7 Chapter 9 – Chapter_9_Part1.ppt slides ClearJunk.java

18 Lab 8 Classes toString methods equals methods static fields
when needed how used static fields

19 Lecture 8 A few things Chapter 9 – rest of slides

20 Lab 9 UML diagram Die objects getFaceValue setFaceValue toString Roll
Math.random vs Random

21 Lecture 9 Talk about constructors belongs to class
do not have a visibility modifier same name as class may have no parameters (no-arg constructor) may have one or more parameters (explicit value constructor) class may have no explicit constructor class may have more than one constructor doesn't return values

22 Lab 10 Code re-use Array of objects Explicit value constructors
No-arg constructors Reading carefully

23 Lecture 10 Professor Harris lecture – see blackboard

24 Lab 11 Designing classes DISCUSSION
Getters and setters are, in general, public methods. Since Fraction is immutable, shouldn’t have them. Fraction is 4/20 not .20 Numerator and denominator are ints

25 Lecture 11 Somewhat of a repetition of lecture 10

26 Lab 12 Inheritance Employee SalariedWorker HourlyWorker

27 Lecture 12

28 Lab 13 Specialization and Inheritance DISCUSSION
Needed to look at javadocs Can’t compare one ampm to another using == because they are Strings – need .equals An AlarmClock is-a Clock (a Clock is NOT an AlarmClock).


Download ppt "Reviewing for Exam Lecture 1?."

Similar presentations


Ads by Google