COP 3540 – Data Structures with OOP - UNF



COP 3538 – Data Structures with OOP

Program #1

Due: 16 May midnight

Using the latest version of NetBeans, 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, Countries.Summer2013.txt, (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 the number of objects of type (class) Country - one object for each record (line) from the input file. You need to use Buffered Reader, etc. as found (examples on Brief Introduction to Input/Output slide 7)) on my web page. Do not use Scanner.

Each Country object will have five properties defined individually as integers or Strings as appropriate for each Country object attribute. You should download this file and use this as input to your program to create the array of Country objects.

2. Print Array of Country Objects. From your main() method, you are to access this array of Country objects and print the array. Use the toString() method found 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, Capital, Region, Region_Nbr, and Capital_Population. Data is to align left for text fields and right with commas inserted for numeric fields. See examples of student work elsewhere on my web page for examples of formatting.)

3. Sort and Display the array using an ascending selection 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.Trans.Summer2013, found accompanying this assignment, you are to search your sorted array of objects (object by object) to ‘find’ or ‘not-find’ each text argument in Search.Trans.Summer2013. This searching of objects is to be a sequential search. Your search key from Search.Trans.Summer2013 is country name.

After skipping two blank lines, display an output header, left justified, with Results of Sequential Search. Then display an ‘appropriate’ column header left justified one time, for each search key (that is, each text item in Search.Trans.Summer2013) you are to display the search key itself, number of probes to find our not find the desired object, followed by the text: ‘found’ or ‘not found’ appropriately placed under the column header to indicate the success or not of your search. Be certain to align the results under the column header item. (Some of the input search arguments may not match. This is intended. You will get a ‘no-hit’ on these and others. (Others may be misspelled intentionally.) Your best approach is to read search arguments from search file into another array, and use those array elements one by one as search arguments, if you wish. There are alternative ways too. Ensure the outputs are professional looking. If you are unsure, ask in class.

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. Your output header should specify: Results of Binary Search. This output header should be followed by the column header as described above.

All done Be proud of your work.

UML

You are to include a UML class diagram. You may use Word, Power Point, or SmartDraw (free) (the latter does a good job) . 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. Your project folder should be named project1.yourname

Methods must be shown with visibility indicators, 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.

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.

Do not wait and do this at the last moment. You may be confused and lose significant points. Do this early!!

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 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. @params and @return must be specified for each method.

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 folder (Dist) that Netbeans produces for you.

You are to zip all files in your P1 subfolder within COP 3538 as expected and send them to me via the Assignment link in Blackboard. Be certain to zip the project folder within your COP3538 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, if you can produce the text verifying that you submitted your program on time, I can happily let you resubmit with no penalty. Ultimately, the project must be completed on time.

Grading

Source Code – 40 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 must be specified in your code

You should have no more than one static method, if at all. You may have a second one in your main class for your input/output. Please ask if you have questions!

Javadoc – 10 points

Appropriateness and completeness of comments is essential

You 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