|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming- G0 S5 {0 i v& Z5 [: L# M
Shanghai - 2007
3 O0 ^2 n8 F3 g. S H+ r' |" pAssignment 2: y- l: u B0 C$ T
Deadline 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)1 C' ?( d: }# U/ s9 [' l3 v7 Y
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.
9 w$ S) v1 I) Z$ w$ L% k1 e9 H* iThe staff must be able to:" T4 G% o. f* f3 y4 z& K3 C
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **." T- L. _9 O$ o6 n
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.# t- |0 K* C6 S7 q: Y h9 p
 The interface should provide a menu so that the staff can:
% a8 X1 C2 }( ]6 ra) Enter the names of the two Java program files to be compared6 B' M2 Q }6 }; E: M) ]( E% d
 For this assignment, it will be assumed that the two Java program files are in the same folder as your program.$ A+ t% M, ^- c! ]; y' ]6 c- W
** 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).
1 E1 m+ N E4 T. \5 E, F6 v& B9 QBSA104 Business Programming – 2007: Assignment 29 h ~% M, c0 b5 S' t/ m1 A" j
Page 2 of 56 z2 `, F- A& g/ K# P) |
b) Print out to the screen all the lines of code that are the same
$ `! @0 j4 ~5 i4 e& a Include the name of the file and the line number of the code being printed for each of the two files
* U; f, t) x9 X9 ?0 ?, c; c# ic) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared( f# I! E9 k S/ _( w: }& T
 the name, username and department of the user) j5 V0 q w; E9 `$ g9 v( O
 the statistics of the comparison3 ?# a: f! R! d E# i
- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different2 M' Z7 g) s& ^
 the recommendation for further checking
& F) e; x( |* c# |' q- 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
N2 ~4 L; X0 Y7 e+ X7 I the names of the two files compared
/ `% f6 W! c' }" n, ~6 {% D" Q0 E7 pd) Leave the program (exit)9 u4 q( {8 R, }- z+ V
The ProgramCompare class: (Total maximum 20 marks available)! o3 L( R; l* d) h6 d0 w! Y6 u
2. 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)
5 O: K* E& {' d3 N4 c$ _" _- ua) provide an error message if the files are not found or there is a problem opening them
% V) B3 n: K$ x# D/ D) r( M! n6 ^9 |b) compare each line of code
2 X6 Q. u% v; y8 y: K% C, Ac) print out the lines that are the same ]1 M) k& C8 g" S. p4 i
d) count the number of lines compared / lines the same1 d* I8 e' @0 m; k. t
The AuthorisedUsers class: (Total maximum 20 marks available)+ u9 I7 G: [6 t D$ I3 C
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)
# l9 a% g9 A9 i8 D4. Provide methods to:; [6 e0 L6 r. R$ C+ f8 k# s
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% E+ ]9 | H2 P5 N C
b) return the name of the authorised user
6 X3 @; E& `* Qc) return the name of the department of the authorised user
/ L! f) o9 @: ]2 N. E; N6 oIndividual Data (Maximum 20 marks available)
- Q: L9 P1 [0 S+ A2 [ A% I# z. L0 Z5. 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.
' P) j* j/ _& Y% k: w, [; k) \0 P% ]Documentation (Maximum 10 marks available)
! L1 {" P' g2 f! T H+ g6. 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.
/ g' k/ O( B4 x7 t& wBSA104 Business Programming – 2007: Assignment 2
6 q6 F1 n( H" x8 sPage 3 of 5 |
|