recitation 3 n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Recitation 3 PowerPoint Presentation
Download Presentation
Recitation 3

Loading in 2 Seconds...

play fullscreen
1 / 5

Recitation 3 - PowerPoint PPT Presentation


  • 50 Views
  • Uploaded on

Recitation 3.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Recitation 3' - alan-gilbert


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
recitation 3

Recitation 3

In this assignment you will write a program to pick up the uppercase letters in an input string. It is pretty much like the program in the lecture, but this time it should be implemented as a bean class that implements an interface. And you also need to use ObjectEditor to enter the input string and to get the uppercase string, which is a string consisting of all of the upper case letters in the input string.

slide2

The code of the main method is provided. So you need to name the class and interface accordingly (class name: AnUppercaseFilter. Interface name: UppercaseFilter).

Also note the import statement and “ObjectEditor.edit(filter)”. Later you will need the code to use ObjectEditor in homework.

import bus.uigen.ObjectEditor;

public class Driver {

public static void main(String[] args){

UppercaseFilter filter = new AnUppercaseFilter();

filter.setString("Initial Input");

ObjectEditor.edit(filter);

}

}

slide3

To follow the bean pattern, you should have two string properties, one for the input string and another for the uppercase letters string.

You also need two getter methods for each of the properties.

Since the input string is the user specified variable while the uppercase letter string is not, you should only have one setter method, which is for the input string.

You can either put the code for picking up in the getter method or in a separated method.

slide4

To let the ObjectEditor recognize the bean class, you need to add annotations above the header of the class.

The annotations are:

importutil.annotations.StructurePattern;

importutil.annotations.StructurePatternNames;

@StructurePattern("Bean Pattern")

The purpose of these annotations is to let the ObjectEditor know what type of the object is , and display the object according to its type.

In future homework you will use annotations to draw rectangles and lines on ObjectEditor.

slide5

Bean Pattern:

http://cs.unc.edu/~dewan/comp401/current/Lectures/StateProperties.pptx

Interface:

http://cs.unc.edu/~dewan/comp401/current/Lectures/Interfaces.pptx

Annotations:

http://cs.unc.edu/~dewan/comp401/current/Lectures/DocumentationAnnotations.pptx

It is helpful to review the code of BMICalculator, which is in these two slides.