|
||||
| |
||||
| |
||||
Homework Assignment 9Due midnight, Monday, 28 April 2008 The assignment can be found on a separate page. Upload the assignment (java and class files) to the dropbox. Homework Assignment 8DEADLINE EXTENDED: Due midnight, FRIDAY, 18 April 2008. Your assignment is to write a program that does a frequency count of letters of the alphabet for whatever file of text you supply to the program. Sample input files:
Your main class should be the standard boilerplate to open files, etc. The frequency counting class needs to have a method to read the file and count the frequencies of the actual letters. I suggest you set up a String with the lower case letters of the alphabet, and then bump the frequency count if the toLowerCase() of a letter in a word is found in that string. This way you can ignore anything that isn't one of the 26 letters of the alphabet. Use an array to store integer-valued frequency counts. Save a total count of all the letters, so you can produce a fraction between 0.0 and 1.0 that is the frequency distribution of letters based on your sample input data. Use an array to compute these fractions, sort that array, and print in decreasing order of frequency. Use the simple bubble-sort of the Candidates4 code, suitably modified. For the English text, your eventual decreasing order of frequencies is probably going to be something close to ETOANIRSH. If you run both the English and the German, you will definitely notice different frequency distributions. My sample frequency counts for the Constitution are here and for the passage from Faust are here. Upload the assignment (java files) to the dropbox. Homework Assignment 7Due midnight, Tuesday, 8 April 2008. Your assignment is to implement a checkbook record program that follows the model of the Candidates4 program . A sample input file of checkbook data can be found here. A sample output file of for this input data can be found here. This output was produced with the "large" payout value specified as $25.00. Instead of a class of Candidate records, you should implement a Check class. Each check record should have fields
The sample data will have the fields appear in exactly this order. You may assume that the PAYEE is a single inputFile.next() string item with no spaces. Since the MEMO item appears as the last item in an input string, you can use the inputFile.nextLine() to read to the newline marker and not worry about whether there are spaces in the MEMO. Your program should first read the entire input file, assigning the input records to an ArrayList as you go. Then echo the input file. Then sort the file by check NUMBER using a modified version of the sortData() method, and then print the data file in its now-sorted order. Finally, instead of the printWithMatch(double howBig) method(s) of the Candidates4 example, implement a method public void printLargePayout() that will print out the check records for which the AMOUNT is greater than or equal to howBig. Note that in the case of the Candidates4 program, the getField(which) is able to return a String variable regardless of which field is asked for. In the case of the checkbook program, you will need to return a String, an int, or a double depending on which field is asked for. There are a couple of ways to deal with this, and any is ok. Hint: One way to cannibalize code and rework it for a new purpose is to copy the structure of the code completely but then to go in and comment out the actual blocks of code inside the methods. This can have the effect of leaving intact all the method references and such, so that the program compiles and a part of it can be tested in its new purpose. In this case, of course, the field names and data types have changed, and the "get" methods will change a little as well. If you were to leave all the code intact, some of it might not compile due to the type checking problems (of an int number instead of a String, for example), and you would not be able to test the code chunk by chunk. Upload the assignment (java files) to the dropbox. Homework Assignment 6Due Friday 7 March at MIDNIGHT Eastern time to the CSE dropbox. The text for this assignment is quite can be found here. Homework Assignment 5Due Monday 3 March at 5pm Eastern time to the CSE dropbox. Do problem 6.17 on page 326 of your text. Homework Assignment 4Due Monday 18 February 2008 at 5pm Eastern time to the CSE dropbox. Objective: Learn how to make decisions and control computation via loops and branches. The description for the assignment is long and can be found one this page. Upload the assignment (java and class files) to the dropbox. Homework Assignment 3Objective: Learn how to write and use threads. Due Monday 11 February 2008 at 5pm Eastern time to the CSE dropbox. From Chapter 3 of the textbook, do problem 3.7 on page 161. Upload the assignment .java files to the dropbox. Homework Assignment 2Objective: Learn Eclipse and how to invoke object methods. Due Monday 4 February 2008 at 5pm Eastern time to the CSE dropbox. From Chapter 2 of the textbook, do a variation of problem 2.13 on page 110. That is, the message to be written should be a civic-minded message "VOTE!" Note that the letters being printed are alld one in a 3 by 5 rectangle of dots. The exclamation point should be printed in the center vertical column, three dots at the top and one dot at the bottom for the period, with an empty dot in between. The "V" should be done with one dot in the center in the bottom row. The aspect ratio isn't quite right in what appears below, but the dot placement is correct. * * *** *** *** * * * * * * * * * * * * * ** * * * * * * * * *** * *** * Upload the assignment (java files) to the dropbox. Homework Assignment 1Due Monday 28 January 2008 5pm Eastern time to the CSE dropbox. The text for this assignment is on a separate page. |
|
|||



