COP 3540 – Data Structures with OOP



COP 3540 – Data Structures with OOP

Program #1

Due: 15 Sept 2010 – Start of Class

Drop Dead date: 20 Sept 2010 – Start of Class

Using NetBeans 6.7 or 6.8, you are to write a Java program using OOP principles to accommodate the following functionality

Assignment #1

Objectives:

Provide student with experience building arrays of objects

Provide student with opportunity in doing file input and output.

Provide student with exercises in learning UML

Provide student with exercises in Javadoc and its various formats

Provide student with exercises in searching, sorting, and comparisons of key searches and sort routines.

Functionality:

Using the external file, AsiaCountries.Fall2010, (Open with WordPad) you are to do the following:

1. Build Array of Country Objects. Using input file, you are to build an array of objects. You are to design and develop a class named Country (in addition to your class named Main) and create objects of type (class) Country - one object for each record (line) from the input file. (You should use Buffered Reader class). Each Country object will have five properties defined individually as integers or Strings as appropriate for each Country attribute. You should download this file and use this as input to your program to create the array of Country objects. Be certain to drag this file into your project folder. (Be aware that this file may be modified for follow on programming assignments.)

2. Print Array of Country Objects. From main() you are to access this array of Country objects and write code to print the array. Use toString() method in the Country objects you will be creating. You are to print a column header, followed by a blank line, followed by single spaced (one line of attributes per object (country) as output. All attributes are to be printed per country object.

These are to be single spaced and all aligned nicely. (Attributes are Country Name, Capital, Region, and Region_Nbr and CountryCode.)

3. Sort and Display array using an ascending bubble sort using the country name attribute of each object as your sort key.

4. Sequential Search and Print Results. Given the input search file, Search.Fall2010 (a text file to be supplied) you are to search the sorted array to ‘find’ or ‘not-find’ each search argument in the search file using a sequential search. Your search key (from the transaction file) is the two-character country code. STEP 4 AND 5 WILL REQUIRE YOU TO RESORT THE ARRAY OF COUNTRIES BASED ON COUNTRY CODE.

After skipping two lines and displaying an appropriate column header one time, for each search key you are to display the search key itself, number of probes, and text: ‘found’ or ‘not found’ to indicate the success of your search. (Some of the input search arguments may not match. This is intended. Clearly USA is not a country name, nor is Japan. But JA is; ZZ is not. You will thus get a ‘no-hit’ on some of these in the search file. (Others are misspelled intentionally.)

5. Binary Search. Similar to (4) above, but use a binary search. Your results, as above, are to produce a column header and to display the search key, number of probes to ‘find’ or ‘not find’ the target followed by text ‘found’ or ‘not found’ text. Again, line these up and include appropriate spacing between each of these attributes on a line. Be certain to skip two lines between the search results generated from (4) and (5). For each search argument, you need only display the same format as above: search key, number of probes, and found or not found indicators. The same input file is used…

6. Ragged Array. Given the four Asian geographical areas, you are to build four ragged arrays – one for each geographical region. Each array is to have only the objects belonging to that region of Asia.

7. Printing Ragged Arrays. By sending each of these ragged arrays to a special print routine, you are to then display in a professional manner each of the four one-dimensional array of region objects in turn and their respective countries in the following format:

East Asia Countries

Country name Capital

China Beijing (entries are to be left justified under the header)

Japan Tokyo

Etc.

North Asia Countries.

Country name Capital

Kazakhstan Astana

Kyrgyzstan Kishkek

Etc.

At the end of printing, you are to display:

Total Countries in East Asia: xxxxx

Total Countries in North Asia: xxxxx



Total Countries in Asia: xxxxx

All done. Be proud of your work.

UML

You are to include a UML class diagram. You may use Word or Power Point only. You may also use SmartDraw, if you wish. Do NOT use Visio or other applications. No other technology may be used! Once you have developed your UML (architectural design), be certain to drag this file into your project folder and be certain it is included with the zip file you will turn in to me.

Use the examples in your 2551 text. Each class listed in your UML diagram must have attributes listed (name, type). Methods must be shown with visibility indicator (+, -) , and number /type of arguments plus the return type.

Connect all classes (label the associations). See lecture 3 (this class) for

sample UML drawings. I may also provide examples of acceptable student work on my web page as further examples. Great examples in the book. Don’t lose easy points on this one.

One more thing: Netbeans will generate UML for you. Do NOT use it, as it does not conform to the standards I desire. I will explain in class.

Javadoc

All programming is to be accompanied by appropriate Javadoc. There is a link on my web page how to appropriate generate Javadoc. Be careful! There are a number of ways to generate Javadoc, several of which are NOT what I want. So follow the directions on the link, please.

Each class and each method in each class (object) must have appropriate documentation associated with it. This means that there must be Javadoc documentation physically preceding each attribute in each class.

Appropriate documentation for methods consists of a short description (single sentence) plus any parameters and any return types specified via @params and @return.

Appropriate documentation for classes includes several sentences describing the purpose of the class. Include @author and any other documentation that assists in documenting that particular class. Of course, objects related to this class should be described via accompanying UML diagrams.

When you generate your Javadoc, all these comments plus a great deal more will be automatically generated for you by NetBeans.

Javadoc, once generated, is automatically included in your project for you. You may observe it in the distribution (dist) folder that Netbeans produces for you./

You are to zip all files in your P1 subfolder within COP 3540 as expected and send them to me via the Assignment link in Blackboard. Be certain to zip the project folder within your COP3540 folder on your desktop. Then, in the Assignment Link in Blackboard, ‘browse’ to identify the zip file, ‘attach’ the zip file, and ‘submit’ this to me. Also, be certain to save any text returned to you by Blackboard, such as the size of the file you submitted, the date and time. If there are any problems with Blackboard (there have been in the past), if you can produce the text verifying that you submitted your program on time, I can happily let you resubmit with no penalty.

Grading

Source Code – 30 points

Indentation and alignment

Internal comments – need Javadoc for each method and certainly each class

Scope terminators big on this. End of fors, whiles, nested structures, classes, methods…

Overall program structure Should have three or four classes.

Attribute and method visibility.

You should have no more than one static method, if at all. Please ask if you have questions!

Program Design – 10 points

Appropriateness of the objects and their services provided

Interface to objects

Attribute and method visibility

If your deliverable has more than two static methods, this is very bad news, and your program will be deemed unacceptable.

Javadoc – 10 points

Appropriateness and completeness of comments

Must generate Javadoc in prescribed manner.

UML – 10 points

Correctness, associations, completeness. This means that the classes you identify are correct, that associations are indicated, and that the attributes and methods are documented within the classes.

I will look for visibility indicators, format of UML statements and class associations. Please look at the examples in your book. Ask if you have questions.

Outputs – 40 points

Accuracy and Format!

Format must be exactly as prescribed. If in doubt, please ask.

Of course, answers must be correct. Verify before you submit for grading.

Your output needs to look very professional!

Program must run correctly to receive a passing grade. This means that your job must run to EOJ (end of job; that is, not bomb) and must produce correct results. Incorrect formatting may cost points, but the job must do what it is intended to do.

You have plenty of time. Start early and do this a little at a time. Verify and validate as you go. (We will discuss…)

Above all, work hard and have fun!! (

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download