addiator 6:22am > cd /class/csse/csse220/200820/ addiator 6:23am > ./check Homework3 Checking Homework3 Clearing /afs/rh/class/csse/csse220/200820/turnin/<your-username>/Homework3/extract/ Copying *.java... done Compiling project... No compile errors found <your-username> - Summary for Reverser Graded on Sat Dec 01 06:23:22 EST 2007 Test Reversed Points Your Answer Line 1/1 Word 1/1 Word Line 1/1 droW Word Word 2/2 droW case-insensitive test Line 2/2 tset evitisnesni-esac case-insensitive test Word 3/3 evitisnesni-esac tset This `is a' test Line 2/2 tset 'a si` sihT This `is a' test Word 3/3 sihT si` 'a tset CapItalIZAtIOn teST Line 2/2 TSet nOItAZIlatIpaC CapItalIZAtIOn teST Word 3/3 nOItAZIlatIpaC TSet !@#$% ^&*(). Line 2/2 .)(*&^ %$#@! !@#$% ^&*(). Word 3/3 %$#@! .)(*&^ Points earned: 25/25 <your-username> - Summary for Sieve Graded on Sat Dec 01 06:23:22 EST 2007 Test Points Your Answer (1 ,1 ) 1/1 (14 ,16 ) 1/1 (51 ,59 ) 3/3 53 59 (1 ,100 ) 5/5 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 (500 ,600 ) 5/5 503 509 521 523 541 547 557 563 569 571 577 587 593 599 (600000,600200) 5/5 600011 600043 600053 600071 600073 600091 600101 600109 600167 600169 (2 ,999 ) 5/5 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 241 251 257 263 269 271 277 281 283 293 307 311 313 317 331 337 347 349 353 359 367 373 379 383 389 397 401 409 419 421 431 433 439 443 449 457 461 463 467 479 487 491 499 503 509 521 523 541 547 557 563 569 571 577 587 593 599 601 607 613 617 619 631 641 643 647 653 659 661 673 677 683 691 701 709 719 727 733 739 743 751 757 761 769 773 787 797 809 811 821 823 827 829 839 853 857 859 863 877 881 883 887 907 911 919 929 937 941 947 953 967 971 977 983 991 997 Points earned: 25/25
Classes to write for the programming part
Class | Description |
Reverser | Reads lines of input from the keyboard (It does not print any kind
of prompt). After reading each line, it first prints the line with
all of the characters reversed. Then it prints the line with the
characters of each "word" reversed, but the order in which the words
come in the line is the same as the original. By "word" here, we
mean a sequence of characters with no spaces. You may want to use
String.split( )or the StringTokenizer class to pick out
the words. For example, if an input line is:The "words" can contain punctuation. then the output should be .noitautcnup niatnoc nac "sdrow" ehT Your program should keep reading and reversing input lines until the user signals end of input (ctrl-z in Windows, ctrl-d in UNIX/Linux ). It should not print anything except the two "reversed" lines for each input line. |
Sieve | The Sieve of Eratosthenes is a famous way of finding all prime
numbers in a range reasonably efficiently. It has been known for a
couple of millennia. A prime number is an integer that is
greater than 1 and has no positive integer factors besides 1 and itself.
Your program (classname: Sieve) must take two positive integers
as its command-line arguments. Both arguments should be positive
integers, and the first one should be smaller than the second one.
Your program is to print (on one line, with a single space after each
number) all prime numbers that are in the closed interval bounded by
these two numbers. For example, if the command-line arguments are
53 103 , then the output should be:53 59 61 67 71 73 79 83 89 97 101 103
For another example, if the command-line arguments are 10000000 10000200 , then the output should be:10000019 10000079 10000103 10000121 10000139 10000141 10000169 10000189
Here is how the algorithm works, assuming that the two numbers are lower and upper.
|
Written problems