|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
! i# B! Y% H0 R. p: |5 q' WShanghai - 20077 ]; X3 M& V* i F& C! X2 i
Assignment 2
1 ^( A. c9 {+ e" u- R' @+ DDeadline 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)( u0 R3 D9 r9 J4 w% E
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./ \ E9 l, D& \5 H4 J6 `, k
The staff must be able to:
$ t6 n9 p# W& ^+ w5 K Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
- v0 h& d/ P( B C) D5 @1. 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.
9 o ]+ N* f0 }9 j( j9 @8 _ The interface should provide a menu so that the staff can:
* \7 ^( o7 K: U* z6 Ca) Enter the names of the two Java program files to be compared
; X9 M! E8 A; _; T$ Y: K- j9 V For this assignment, it will be assumed that the two Java program files are in the same folder as your program.
4 m2 }. t6 i; \% B; a8 O0 B2 K** 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).
D& W# ?9 A4 t& D( qBSA104 Business Programming – 2007: Assignment 2
9 q& O, i: m& d& @2 XPage 2 of 5* ?& e' h8 ]" o) T
b) Print out to the screen all the lines of code that are the same4 y* M5 E& o) x' r
 Include the name of the file and the line number of the code being printed for each of the two files1 G1 y& o& Y& i6 E7 k) ^( N8 I) J
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared& Q1 m C9 D. B$ t
 the name, username and department of the user
* ]3 V, E+ C! \4 w the statistics of the comparison
7 {2 e2 ]! _- p1 |; D9 V- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different
/ I6 [4 Z5 A$ K7 Y the recommendation for further checking
" r- b8 M. a- V+ c1 r- 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
1 f7 d$ o9 N( T the names of the two files compared
! ^7 @' l3 I5 d, E/ w! Fd) Leave the program (exit)3 j4 m) P. i' C
The ProgramCompare class: (Total maximum 20 marks available)
8 h5 z: v) L+ y0 v$ T7 x2. 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): Y! h- r: q1 P9 [1 Z/ F( o! a
a) provide an error message if the files are not found or there is a problem opening them7 {6 b* @* N1 F3 `
b) compare each line of code
# |9 @+ L1 | S8 t- N _! i+ \1 Tc) print out the lines that are the same, F8 W6 r7 ?- f, Z4 r E
d) count the number of lines compared / lines the same: p% U- z0 }* g7 ]! W# S& Q
The AuthorisedUsers class: (Total maximum 20 marks available)
; `8 q4 d# K* T5 f2 v, x3. 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)
. k: L. z( R/ z* ]. U! L4. Provide methods to:
0 F1 a/ t8 }* B7 aa) 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
. {: ?* g! m1 m1 ~9 C4 M0 [b) return the name of the authorised user
/ t% S0 U$ n0 w0 o8 `' }1 \c) return the name of the department of the authorised user6 e) g1 p4 j5 X6 n+ x" k9 ]
Individual Data (Maximum 20 marks available)6 i8 y" y' W) X; x4 S
5. 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.
5 B2 A( \1 u: ?* R! W8 E5 fDocumentation (Maximum 10 marks available)
! G' k* L; m, F. W# ]- y6. 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.+ F* T+ ]. N3 y2 O, z
BSA104 Business Programming – 2007: Assignment 2
2 C6 A* X% h, `# |8 H! pPage 3 of 5 |
|