Presentation is loading. Please wait.

Presentation is loading. Please wait.

June 1, 2000 Object Oriented Programming in Java (95-707) Java Language Basics 1 Lecture 4 Object Oriented Programming in Java Class Design Process.

Similar presentations


Presentation on theme: "June 1, 2000 Object Oriented Programming in Java (95-707) Java Language Basics 1 Lecture 4 Object Oriented Programming in Java Class Design Process."— Presentation transcript:

1 June 1, 2000 Object Oriented Programming in Java (95-707) Java Language Basics 1 Lecture 4 Object Oriented Programming in Java Class Design Process

2 June 1, 2000 Object Oriented Programming in Java (95-707) Java Language Basics 2 Logistics

3 June 1, 2000 Object Oriented Programming in Java (95-707) Java Language Basics 3 System Design Process extract objects from problem statement decide on the classes that will make up the problem domain

4 June 1, 2000 Object Oriented Programming in Java (95-707) Java Language Basics 4 Class Design Process decide on behavior & the way the class will be used write the interface for the class write a sample program that uses the interface write a skeleton class that implements the interface enhance the skeleton class until its stated behavior is fully implemented

5 June 1, 2000 Object Oriented Programming in Java (95-707) Java Language Basics 5 Decide on Behavior extract from problem statement pay attention to verbs plain English these are your methods

6 June 1, 2000 Object Oriented Programming in Java (95-707) Java Language Basics 6 Write the interface for the class specify –parameters –return types –description of logic in the methods of the interface

7 June 1, 2000 Object Oriented Programming in Java (95-707) Java Language Basics 7 Write a Sample Program sample program to exercise the interface purposes: –completeness of the interface –appropriateness of return types –appropriateness of parameters

8 June 1, 2000 Object Oriented Programming in Java (95-707) Java Language Basics 8 Write a Skeleton Class create a class that implements the interface

9 June 1, 2000 Object Oriented Programming in Java (95-707) Java Language Basics 9 Enhance the Skeleton Class iterative process add the variables you may change the implementation but in theory you should not change the interface enhance the sample program as you improve the class itself

10 June 1, 2000 Object Oriented Programming in Java (95-707) Java Language Basics 10 Problem Statement: EasyReader An EasyReader is a class that helps with the problem of interactive input and output. The class allows the writing of text strings to the monitor The class also helps with the prompting and reading-in of text strings typed from the keyboard The class isolates the user from things like System.in and System.out

11 June 1, 2000 Object Oriented Programming in Java (95-707) Java Language Basics 11 EasyReader Follow the design process outlined earlier Create a test program for the EasyReader class Here is a tip: Reading an entire line from the keyboard: BufferedReader reader; reader = new BufferedReader(new InputStreamReader(System.in)); String s = reader.readLine();

12 June 1, 2000 Object Oriented Programming in Java (95-707) Java Language Basics 12 Problem Statement 2: Person A person has a last name, first name, and a title A person can give you their first name followed by the last name or their first name followed by the last name A person can give you their initials based on the first name and last name

13 June 1, 2000 Object Oriented Programming in Java (95-707) Java Language Basics 13 Person Follow the design process outlined earlier Create a test program that uses the EasyReader developed earlier to create and display the initials of a person here are two tips: the class “String” has two useful methods: String substring(int,int); String concat(String s);

14 June 1, 2000 Object Oriented Programming in Java (95-707) Java Language Basics 14 Problem Statement 3: Employee An employee is a person that has a last name, first name and title An employee has a pay rate which can be used to calculate their pay based on a particular number of hours

15 June 1, 2000 Object Oriented Programming in Java (95-707) Java Language Basics 15 Employee Follow the design process outlined earlier Create a test program that uses the EasyReader developed earlier to create and calculate the pay of an employee


Download ppt "June 1, 2000 Object Oriented Programming in Java (95-707) Java Language Basics 1 Lecture 4 Object Oriented Programming in Java Class Design Process."

Similar presentations


Ads by Google