|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming1 _: N0 v T# G, O. t: X
Shanghai - 20074 J( H7 x6 \, J5 d/ r8 j2 n+ d5 V
Assignment 2
" Z- ~' w/ ~5 S uDeadline for Submission: 10:00 pm (Shanghai time), Tuesday 15th May 2007 Assessment Weighting: 20% of the total assessment for BSA104 Assignment Type: Individual Scenario: The teaching staff at a nearby university are concerned that some of their students are submitting other students‟ work. They need a simple Java program that will compare the text of two other Java programs, line by line, for equality, and then print out the results, and a recommendation. Requirements: Consider the three Java Classes: ProgramCompareMenu.java, ProgramCompare.java and AuthorisedUsers.java, available from the Assignment 2 page on Vista. You are required to perform the following tasks: The ProgramCompareMenu class: (Total maximum 20 marks available)! K1 W% ~7 k& ^" y% Q8 N0 N
1. Provide a basic text-based menu interface to the ProgramCompare class so that it can be used by two staff members to determine if the two supplied Java programs are the same or similar.
: i2 g; O6 o7 [The staff must be able to:9 L# ^! B: c. `2 s
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
3 u, j/ T3 M& o7 \+ @4 h1. The user should not be able to use the „system‟ until they have provided the correct user name and PIN combination. You should give them a second or third chance to get it right before shutting the „system‟ down.
8 h" `0 a8 n8 l4 v5 z8 K* v The interface should provide a menu so that the staff can:
' h8 S6 Z$ S' o' Z4 _; X5 fa) Enter the names of the two Java program files to be compared
! p) R' m) k7 E% }; |; C For this assignment, it will be assumed that the two Java program files are in the same folder as your program.
( n' F# O2 ]$ a** You must use the two user names and PINs provided in your individual data available from the Assignment 2 page on Vista (see requirement 5 below). The user names and PINs should be included in your code, and the output to the screen should prompt the user with the user names and passwords (for marking purposes).2 m T- z% ?( f% F/ i
BSA104 Business Programming – 2007: Assignment 22 d( M' h7 r; p7 W8 t! {
Page 2 of 5
5 J0 q3 H( k: K+ r" Vb) Print out to the screen all the lines of code that are the same
7 i7 F& l0 L) j4 H' t6 W Include the name of the file and the line number of the code being printed for each of the two files
3 s5 b; \: D; T7 x c2 ec) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared
* M9 U+ i# ^' U/ ` the name, username and department of the user
) n5 o9 @; u! F% t0 W2 I the statistics of the comparison
- {& }2 H' m' R0 b. j) |, `5 e- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different5 y' L' h0 a# d3 q
 the recommendation for further checking
1 t& G8 G# W5 f; W- For example: if more than 5 (five) lines of code are the same in each Java program file, then print a recommendation to the screen that the staff member check the files more closely
$ M0 | Y1 t- T8 _* _ the names of the two files compared" i0 W6 J( i4 g+ T, a+ l V
d) Leave the program (exit)
! ^4 K- q) J i$ X% n+ \: SThe ProgramCompare class: (Total maximum 20 marks available)
* f( f4 Y: u* N( r3 {7 h; n2. Provide a method/s to read in each line of code from the two files identified by the user: (assumed that the two Java program files are in the same folder as your program)1 {: M& t# T1 T% F2 a% r
a) provide an error message if the files are not found or there is a problem opening them2 A4 Y4 H4 b0 Q! O
b) compare each line of code
% P+ a" Z+ `+ t7 p m- V: }! vc) print out the lines that are the same3 ?& v) ^* j& X# Y9 F
d) count the number of lines compared / lines the same
6 D4 V* V; p8 d' L% x1 zThe AuthorisedUsers class: (Total maximum 20 marks available)
, @ d+ x7 @2 t. f4 P, D; p$ I. [3. Provide an object that contains the name, username, PIN, and Department of the authorised users of the program (user names and PINs as provided in your individual data - see requirement 5 below)
4 f- N: o0 e/ v+ d8 j$ y4 u& g* j4. Provide methods to:5 ]/ s: D4 l. _6 F" n% r1 Z! i
a) compare the stored username and PIN with the one entered by the user - return a value that indicates whether they match or do not match
7 ~# n! ], A( gb) return the name of the authorised user! \& M( P, Z4 p8 o4 n
c) return the name of the department of the authorised user
3 J4 r8 _$ W6 f0 H6 m$ D2 L" ~& NIndividual Data (Maximum 20 marks available)
6 H2 {. z- ?7 D, D/ Z$ o+ H, d5. You will be given two staff member names, usernames, PINs, and department name, plus a set of two Java program files to compare using your program. You will need to log onto the BSA104 Assignment 2 page on Vista to generate your individual data and instructions for this requirement. You will need to use your University of Tasmania (UTas) student number.
0 T- J' t8 V4 Q0 ADocumentation (Maximum 10 marks available)
7 ^0 E# {2 i- K6. Your program files should be fully documented, at least to the same standard as demonstrated in the textbook. This includes in-code comments, descriptions, and where appropriate, explanations for each new constructor, method and variable.6 m! q, x$ d/ y/ ~0 q# G+ f
BSA104 Business Programming – 2007: Assignment 2
1 t5 L. h3 g4 r- a# D( v3 a* P( |Page 3 of 5 |
|